A blog about programming, Web development, Open Source, Linux and DevOps.

Go - Packages

Go code is organized into packages:

  • A package consists of 1 or more .go files in a directory
  • Every source file starts with a package declaration that specifies the name of the package that the file belongs to
  • Packages provide a way to organize and reuse code in Go programs
  • Good package names are short and clear, they are lower case, with no under_scores or mixedCaps ( More on package names )
// A comment line before the package declaration
// can be used to document the package.
package example