what is it?

go modules can now track executable dependencies using tool directives in go.mod (from golang v1.24).

this removes the need for the previous workaround of adding tools as blank imports to a file conventionally named “tools.go”

go get -tool

the new -tool flag for go get causes a tool directive to be added to the current module for named packages in addition to adding require directives

# Language server
go get -tool golang.org/x/tools/gopls
 
# Go tools (multiple tools in this repo)
go get -tool golang.org/x/tools/cmd/goimports
go get -tool golang.org/x/tools/cmd/gorename
# Note: "gotools" typically refers to the collection above
 
# Code formatter
go get -tool mvdan.cc/gofumpt
 
# Linter
go get -tool github.com/golangci/golangci-lint/cmd/golangci-lint
 
# Code generation tools
go get -tool github.com/fatih/gomodifytags
go get -tool github.com/josharian/impl
 
# Debugger
go get -tool github.com/go-delve/delve/cmd/dlv
 
# Line length formatter
go get -tool github.com/segmentio/golines

go install tool

to install the above tools into your GOBIN directory, run

go install tool