-
Notifications
You must be signed in to change notification settings - Fork 89
"Tools as dependencies": consider continuing to someone later using the repo and recreating the tool #77
Comments
Yes, agreed. Many of the guides, this one included, end rather abruptly. |
Is there a solution here that doesn't involve running |
@atombender - you can Is that the kind of thing you were after? |
I didn't realize That suggests that installing binaries via |
Well, other than performance. It appears that $ time golangci-lint > /dev/null
golangci-lint > /dev/null 0.08s user 0.01s system 130% cpu 0.070 total
$ time go run github.com/golangci/golangci-lint/cmd/golangci-lint > /dev/null
go run github.com/golangci/golangci-lint/cmd/golangci-lint > /dev/null 2.09s user 1.01s system 179% cpu 1.731 total |
Almost correct; the resulting binary is not cached. Hence it links every time (and that's the slow step). Hence https://github.com/myitcv/gobin/wiki/FAQ FWIW, I use There is a slight overhead for FYI - the original issue where I asked about why |
Looks like a nice tool, but my goal here is to reduce manual steps needed to work with a codebase. Having to tell people to We're currently using Docker for this, and it's actually working really well. The developer invokes a helper script and does something like Obviously this is an interim solution until something better comes along. I don't know if the Go team is working on something more permanent? For example, I'd love to be able to declare a tool dependency in a special section of |
Absolutely. The tool is, as the wiki explains, nothing more than an experiment to understand this space better.
The current status is that https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md remains the best practice (reference golang/go#25922 (comment)). Working with that you either need to In myitcv/gobin#44 we explored other possibilities of tracking tool dependencies separately. But nothing has really stood out as "better". On the most recent golang-tools (https://github.com/golang/go/wiki/golang-tools) call, @ianthehat mentioned he is going to put together a proposal on how I'll try to remember to post a link to Ian's proposal when it gets created, otherwise keep an eye out in the golang-tools call minutes. |
Thanks for all that detail! It would be awesome if |
This topic came up recently in the Slack channel. All that's needed was Another option noted in that thread was |
This is less than ideal because it's path-based and not package-based.
This is better, but it uses What you probably want in this situation is:
|
@atombender My somewhat hacky solution for this is is to put this in a file:
Then you only need to run |
Another option for installing all tools defined in go install $(go list -f "{{range .Imports}}{{.}} {{end}}" tools.go) |
The "Tools as dependencies" example:
https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md
currently ends with committing and pushing the repo.
It could be helpful to continue to also show someone later using the repo to recreate the tool at the proper version. In other words, how to use a repo that has been set up with a tools.go.
The text was updated successfully, but these errors were encountered: