liveBook · Manning

Dependency management

As explained in Go in Action, Second Edition

Dependency management is the process of declaring, resolving, versioning, and obtaining software components required by a project.

Dependency management organizes the components a Go project needs so they can be resolved, versioned, fetched, and built reproducibly. Go modules use go.mod for module identity and requirements, while go.sum records cryptographic checksums for dependency source and metadata. section 11.1

A practical module workflow includes:

  • Initialize a module with go mod init and choose a module path matching its repository location. section 11.1
  • Add dependencies explicitly with go get, or import them in code and run go mod tidy. section 11.1
  • Pin direct and transitive requirements in go.mod and verify their contents through go.sum checksums. section 11.1

Module requirements

An API module can require a shared domain module and github.com/gorilla/mux at declared versions, while recording other dependencies as indirect requirements. section 11.1

module github.com/YOUR_USERNAME/go-news/api #1

go 1.25 #2

require ( #3
    github.com/YOUR_USERNAME/go-news/domain v0.0.1
    github.com/gorilla/mux v1.8.0
)

require (
    github.com/other/transitive v0.5.2 // indirect #4
)

Inspect a concrete go.mod file showing the module declaration, Go version, direct requirements, and an indirect transitive dependency. section 11.1

How Go in Action, Second Edition covers it

How deep it goes
Explains module initialization, requirement updates, version selection, transitive dependencies, and checksum verification without detailing resolver internals.
Examples
Uses go mod init, go get, go mod tidy, go.mod requirements, and go.sum checksum entries.
What you can do after
Operate Go's module tooling to declare, fetch, update, verify, and reproduce project dependencies.
How it connects
Connects Go modules with microservice architecture, module paths, reproducible builds, versioning, and cryptographic integrity.

Also explained in

Compare how 5 books explain dependency management →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Go in Action, Second Edition. The section links point to the parts of the book it draws on.