You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2021. It is now read-only.
There are a couple usability issues related to absence of gobin-installed binaries in PATH.
First one is obvious: gobin -m -run github.com/golangci/golangci-lint/cmd/golangci-lint is a way harder to type than just golangci-lint.
Second is a bit more subtle: protoc looks for installed plugins in PATH, so to let it find gobin-installed plugins we had to replace //go:generate protoc … with something like //go:generate sh -c "protoc $(gobin -m -p $(go list -tags=tools -f '{{range .Imports}}{{println .}}{{end}}' ../../third_party | grep protoc-gen) | sed -e s,^,--plugin=,) … (where ../../third-party is a directory containing tools.go).
Maybe it's worth to provide a way to run any command with PATH prepended with all directories with gobin-installed binaries in module-mode, e.g.:
# same as `export PATH=.gobincache/github.com/golangci/golangci-lint/@v/v1.31.0/cmd/golangci-lint:$PATH; golangci-lint`
$ gobin -m golangci-lint
# same as `export PATH=.gobincache/github.com/golangci/golangci-lint/@v/v1.31.0/cmd/golangci-lint:…other:installed:tools:here:…:$PATH; protoc …`
$ gobin -m protoc …
Of course we can set PATH right now using command shown below, but there are a couple issues with it:
There are a couple usability issues related to absence of gobin-installed binaries in PATH.
First one is obvious:
gobin -m -run github.com/golangci/golangci-lint/cmd/golangci-lint
is a way harder to type than justgolangci-lint
.Second is a bit more subtle:
protoc
looks for installed plugins in PATH, so to let it find gobin-installed plugins we had to replace//go:generate protoc …
with something like//go:generate sh -c "protoc $(gobin -m -p $(go list -tags=tools -f '{{range .Imports}}{{println .}}{{end}}' ../../third_party | grep protoc-gen) | sed -e s,^,--plugin=,) …
(where../../third-party
is a directory containingtools.go
).Maybe it's worth to provide a way to run any command with PATH prepended with all directories with gobin-installed binaries in module-mode, e.g.:
Of course we can set PATH right now using command shown below, but there are a couple issues with it:
/bin/true
this way took3.531 real 12.202 user 3.191 sys 43MB RAM
Here is tools.go used in examples above:
The text was updated successfully, but these errors were encountered: