Murahashi [Matt] Kenichi
Posted on December 9, 2019
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
💖 💪 🙅 🚩
Murahashi [Matt] Kenichi
Posted on December 9, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
rails Extending the Ruby on Rails 8 authentication with OAuth sign in and the missing RSpec test suite
November 28, 2024