maxbrunsfeld / counterfeiter

A tool for generating self-contained, type-safe test doubles in go
MIT License
931 stars 90 forks source link

docs: Improve `go run` invocation #276

Closed jhvhs closed 5 months ago

jhvhs commented 5 months ago

Since Go 1.17 the recommended way to track a tool version is go run tool@version which eliminates the need for tools.go. Given that the supported Go versions are 1.22-1.20, it makes sense to simplify the installation process.

joefitzgerald commented 5 months ago

Thanks for the contribution!

The issue with the go run tool@version approach is that the version must be embedded in the generate directive. If you have many directives, this becomes a maintenance burden to keep all the versions updated.

Alternatively, using a tools.go embeds the version in the go.mod, allows for the use of go.sum to validate the version hasn't changed, and permits for use of tooling that can indicate outdated versions and help update them.

I am inclined to continue to advocate that people use a tools.go.

jhvhs commented 5 months ago

In this case, the only thing that must be updated is the link to the go documentation explaining the tooling versioning strategies, as it is outdated.