Go package
A folder of Go source files that are compiled together and share one package name, which other code imports as a unit.
In more detail
Every Go file starts with a package line, and all files in a folder must use the same one. The folder name is usually the import name, so a package in check/ is used as check.Describe. Packages are how you split a tool into parts with clear boundaries.
Example
package checkRelated terms
- Go module — A tree of Go packages that is versioned and released together, described by a go.mod file at its root.
- import path — The string that identifies a package in an import line: the module path followed by the folder inside the module.
- package main — The special package name that makes a Go program executable, together with a function called main where the program starts.
- exported identifier — A name in Go that starts with a capital letter, which makes it visible to code in other packages.
- internal package — A package inside a folder called internal, which Go allows only code within the same parent folder tree to import.
Taught in
- What Go Is and Why It Matters — Concurrent Systems Programming with Go
- Installing the Go Toolchain — Concurrent Systems Programming with Go
- Go Workspaces and Modules — Concurrent Systems Programming with Go
- Variables, Typing, and Zero Values — Concurrent Systems Programming with Go
- The Standard testing Package — Concurrent Systems Programming with Go
- The context Package — Concurrent Systems Programming with Go
- Files and the os Package — Concurrent Systems Programming with Go
- Streams and the io Package — Concurrent Systems Programming with Go