Golang Packaging Structure & Best Practices [Tutorial] | GoLinuxCloud
Learn about golang packaging with how to create custom packages, install third-party packages, import packages, export package members, and organize Go code into reusable packages.
Golang packaging is how you turn folders of .go files into reusable units: a module (everything under one go.mod ) contains many packages (one per directory, one package name per folder). Readers searching golang package naming convention, golang package structure, go package structure, or golang package design are usually deciding module paths, directory layout, exported APIs, and how dependencies appear in go.mod . This article is a compact go packages tutorial for that layout; for installing Go itself, see getting started with Go . Tested with Go 1.24 on Linux. Modules: the root of golang p
related reading
- Go import local package & golang import package from another directorygolinuxcloud.com
- Package names - The Go Programming Languagego.dev
- GitHub - golang-standards/project-layout: Standard Go Project Layoutgithub.com
- Golang init function: rules, order of execution, and examplesgolinuxcloud.com
- Frequently Asked Questions (FAQ) - The Go Programming Languagego.dev
- Go go-to guide · YourBasicyourbasic.org
- Effective Go - The Go Programming Languagego.dev
- tree package - golang.org/x/tour/tree - Go Packagespkg.go.dev
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- The Go Programming Language Specification - The Go Programming Languagego.dev
- Using go fix to modernize Go code - The Go Programming Languagego.dev
- Demystifying Function Parameters in Go- Alex Edwardsalexedwards.net