Keep track of dev dependencies in go.mod
When running make setup, the dev tools will be installed into the project's local .GOPATH. However, this overwrites the go.mod and go.sum files with a reference to those tools. The make deps-check rule will fail If the changes are committed by mistake.
Using a tools.go file is a common pattern to keep track of dev dependencies inside the go.mod file.
The release-cli tools.go has an example of how to do it. We also reference https://marcofranssen.nl/manage-go-tools-via-go-modules/:
To ensure my tool dependencies are not removed and can leverage the Go Modules, I create a file tools.go. In this file I will list all my tool dependencies using an import statement.
To do:
- Add a file called
tools.goto the root directory and add the dev/tool dependencies. -
make deps-checkwill add an entry togo.mod, consider version locking to a desired release. - Commit the changes.
Edited by Jaime Martinez