TL;DR
go install \
github.com/sanemat/go-importlist/cmd/import-list \
github.com/sanemat/go-xgoinstall/cmd/x-go-install
import-list -z tools.go | x-go-install -0
Sometimes I want to track and use tool dependencies.
// +build tools
package tools
import (
_ "github.com/sanemat/go-importlist/cmd/import-list"
_ "github.com/sanemat/go-xgoinstall/cmd/x-go-install"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/goimports"
)
How can I track tool dependencies for a module?
Manage Go tools via Go modules | Marco Franssen
Recommended way:
$ cat tools.go | grep _ | awk -F'"' '{print $2}' | xargs -tI % go install %
But I want to use it on cross-platform, ubuntu, mac, and windows.
$ import-list tools.go
github.com/sanemat/go-importlist/cmd/import-list
github.com/sanemat/go-xgoinstall/cmd/x-go-install
golang.org/x/lint/golint
golang.org/x/tools/cmd/goimports
Then go install all dependencies.
$ import-list tools.go | x-go-install
Split by NULL is more secure ๐
$ import-list -z tools.go | x-go-install -0
https://github.com/sanemat/go-importlist
https://github.com/sanemat/go-xgoinstall
Top comments (0)