packagemain.tech

packagemain.tech

How to use the new "tool" directive

Go 1.24 new "tool" directive.

Alex Pliutau's avatar
Alex Pliutau
Apr 12, 2025
∙ Paid

The Go build system is known for its efficiency and continuous improvement. Go 1.24 introduces a significant enhancement with the “tool” directive, addressing how Go-based dev tools are managed.

Previously, managing tools like linters (golangci-lint), code generators (mockery, oapi-codegen), or other build utilities often involved manual installation steps (using “go install” or some package manager) outside the project's dependency management, leading to potential version inconsistencies across development environments and CI systems.

I’ve seen it many times when two developers generate different code by using the same command, only because the versions of these tools are different. There are workarounds to “fix“ the versions in fake “tools.go” file, but it’s not enough and felt dirty.

But not anymore! Go 1.24 addresses these challenges directly with the “tool” directive.

User's avatar

Continue reading this post for free, courtesy of Alex Pliutau.

Or purchase a paid subscription.
© 2026 Aliaksandr Pliutau · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture