go.mod

The text file at the root of a Go module that records its module path, the Go version it needs and the other modules it depends on.

In more detail

go mod init creates it, and commands such as go get and go mod tidy keep it up to date. A diff on go.mod in a pull request is effectively a dependency review. Only one go.mod sits at the root of a module; packages are folders underneath it.

Example

module course.local/probe

go 1.23.12

Related terms

Taught in

References