Skip to content

Go module system (go.mod)

The Go module system is the dependency management system for the Go programming language.^[400-devops__09-Scripting-Language__go.md] A module is defined by a go.mod file, which serves as the root of the dependency tree.^[400-devops__09-Scripting-Language__go.md]

Initialization

To initialize a new module, the go mod init command is used^[400-devops__09-Scripting-Language__go.md]. The standard syntax for creating this file is:

go mod init <module-path>

For example, running go mod init example.com/myproject creates a go.mod file declaring the module's path^[400-devops__09-Scripting-Language__go.md].

Sources

^[400-devops__09-Scripting-Language__go.md]