A reproducible build produces consistent results from controlled source and dependency inputs. Go supports this through the coordinated use of go.mod and go.sum: one records module requirements, while the other records cryptographic checksums for dependency content and module files. section 11.1
A practical dependency workflow is:
- Initialize a module with go mod init, establishing its module path and import prefix. section 11.1
- Declare or fetch dependencies with go get, including specific versions when required. section 11.1
Pinned module dependencies
A service module can require a shared domain module and github.com/gorilla/mux at explicit versions, while recording transitive dependencies separately as indirect requirements.
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
Inspect the checksum entries that let Go verify dependency source and go.mod content before use. section 11.1
