microsoft / go-winio

Win32 IO-related utilities for Go
MIT License
952 stars 182 forks source link

go.mod: remove golang.org/x/tools dependency #266

Open thaJeztah opened 1 year ago

thaJeztah commented 1 year ago

This removes golang.org/x/tools/cmd/stringer as a direct dependency of this module, instead using "go install" to install the required tool as part of go generate. I opted for pinning to a fixed version for reproducibility, but we could switch to @latest if there's no concerns for getting newer versions.

With this patch:

which stringer
# (no output)

go generate ./pkg/guid
which stringer
/Users/thajeztah/go/bin/stringer
thaJeztah commented 1 year ago

@kevpar @helsaawy ptal 🤗

helsaawy commented 1 year ago

I don't think I understand the need for this. I agree with removing logrus as a dependency, but for stringer, I would prefer keeping the tools file, since it follows the recommended approach to version dependencies.

If trimming the dependencies for upstream projects is the goal, starting in go1.17, stringer should not be considered a dependency by modules that import winio.

Also, using go run doesn't install stringer by putting it $(go env GOPATH)\bin, but instead builds and runs it out of go env GOCACHE, so that also keeps the path clean as well.