Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thaJeztah
Copy link
Contributor

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah requested a review from a team as a code owner November 9, 2022 12:11
@thaJeztah
Copy link
Contributor Author

@kevpar @helsaawy ptal 🤗

@helsaawy
Copy link
Contributor

helsaawy commented Nov 9, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants