Re:Go 1.24's go tool is one of the best additions to the eco...
by rednafi on Tuesday January 28, 2025 @04:59AM
(#42850646)
Ah, thanks. This isn't much of an upgrade from the `tools.go` convention, where the tools are underscore-imported. All it does is provide an indication in the `go.mod` file that some dependencies come from tools.
Plus, `go tool <tool-name>` is slower than `./bin/<tool-name>`. Not to mention, it doesn’t resolve the issue where tools might use a different version of a dependency than the app.
Re:Go 1.24's go tool is one of the best additions to the eco...
by pragma_x on Tuesday January 28, 2025 @11:10AM
(#42853974)
Exactly. You lose build isolation for those tools, but you have the convenience of shipping something tested and proven (ideally) alongside the project they support. At the same time, this mess all stays isolated from the parent environment which may be the bigger fight that devs have on their hands - not everyone is using Nix or container isolation of some sort.
I also see this as sugar for `go build` or even `go run`. Or as something way easier than the `go generate` + `//go:generate go run` hack. So we can look at this as a simple refinement for existing practices.
Re:Go 1.24's go tool is one of the best additions to the eco...
by kbolino on Tuesday January 28, 2025 @01:40PM
(#42856153)
go tool is only slower when (re-)compilation is needed, which is not often. You'd have to pay the same price anyway at some point to build the binary placed in ./bin.
Re:Go 1.24's go tool is one of the best additions to the eco...
by kbolino on Wednesday January 29, 2025 @09:11AM
(#42865065)
I'm actually not 100% on this; there is a cache, and it should speed things up on subsequent runs, but maybe not as much as one might think: https://news.ycombinator.com/item?id=42864971
No. The binary size is related to the number of dependencies you use in each main package (and the dependencies they use, etc). It does not matter how many dependencies you have in your go.mod.