Skip to content

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

Closed
Sebastiaan van Stijn (thaJeztah) wants to merge 1 commit into
microsoft:mainfrom
thaJeztah:remove_x_tools
Closed

Sebastiaan van Stijn (thaJeztah) wants to merge 1 commit into
microsoft:mainfrom
thaJeztah:remove_x_tools

Conversation

@thaJeztah

Copy link
Copy Markdown
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

Copy link
Copy Markdown
Contributor Author

@helsaawy

Copy link
Copy Markdown
Contributor

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.

@jterry75

Copy link
Copy Markdown
Contributor

This is way old and we just replaced it. So closing.

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.

3 participants