Skip to content
Daily Dev Tip

This tip lives in your new tab — for free.

Install for Chrome →
GO

Track tool dependencies in go.mod with tool directives (Go 1.24)

go.mod
go
// Add a build/dev tool to the module:
//   go get -tool golang.org/x/tools/cmd/stringer

// go.mod now records:
tool golang.org/x/tools/cmd/stringer

// Run it via the module, pinned to the recorded version:
//   go tool stringer -type=Pill

Go 1.24 tracks executable dependencies with `tool` directives in `go.mod`, retiring the old `tools.go` blank-import hack. `go get -tool` records the tool and pins its version alongside your other deps, so every developer and CI runs the same version. `go tool <name>` executes it. This keeps code generators, linters, and migration tools reproducible and version-locked instead of relying on whatever happens to be installed globally.

go1.24modulestoolingdependencies