go get
たまに go get ~
の書き方で、-v
とか -u
をつけるのをよく見るので少し調べてみました。
下記記事を主に参考にしました。
go - The Go Programming Language
-v
The -v flag enables verbose progress and debug output.
go - The Go Programming Languageより引用
日本語訳
-vフラグは、詳細な進行状況とデバッグ出力を有効にします。
これは デプロイするときのDockerfileにはつけるの必須ですかね。
-t
The -t flag instructs get to consider modules needed to build tests of packages specified on the command line.
日本語訳
-t
フラグは、コマンドラインで指定されたパッケージのテストをビルドするために必要なモジュールを考慮するようにgetに指示します
-u
The -u flag instructs get to update modules providing dependencies of packages named on the command line to use newer minor or patch releases when available. Continuing the previous example, 'go get -u A' will use the latest A with B v1.3.1 (not B v1.2.3). If B requires module C, but C does not provide any packages needed to build packages in A (not including tests), then C will not be updated
go - The Go Programming Languageより引用
日本語訳
-uフラグは、コマンドラインで指定されたパッケージの依存関係を提供するモジュールを更新して、新しいマイナーリリースまたはパッチリリースが使用可能になったときにそれを使用するようにgetに指示します。
-t と合わせて使用
When the -t and -u flags are used together, get will update test dependencies as well.
-t
flagと -u
flagを一緒に使うことで依存関係を解消できるようです。
試しに -u
sql-migrate
で試ししました。
root@c615ebd3aee6:/go/bin# go get -u github.com/rubenv/sql-migrate/...
go: finding github.com/rubenv/sql-migrate latest
go: finding golang.org/x/sys latest
go: finding gopkg.in/yaml.v2 v2.2.8
go: finding github.com/posener/complete v1.2.3
go: finding github.com/go-sql-driver/mysql v1.5.0
go: finding google.golang.org/appengine v1.6.5
go: finding github.com/olekukonko/tablewriter v0.0.4
go: finding github.com/denisenkom/go-mssqldb latest
go: finding github.com/mattn/go-isatty v0.0.12
go: finding github.com/mattn/go-runewidth v0.0.8
go: finding golang.org/x/crypto latest
go: finding github.com/mattn/go-colorable v0.1.6
go: finding github.com/lib/pq v1.3.0
go: finding github.com/golang-sql/civil latest
go: finding github.com/fatih/color v1.9.0
go: finding github.com/armon/go-radix v1.0.0
go: finding github.com/mattn/go-sqlite3 v2.0.3+incompatible
go: downloading github.com/olekukonko/tablewriter v0.0.4
go: downloading github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading github.com/fatih/color v1.9.0
go: downloading github.com/mattn/go-sqlite3 v2.0.3+incompatible
go: downloading github.com/posener/complete v1.2.3
go: downloading github.com/lib/pq v1.3.0
go: extracting github.com/olekukonko/tablewriter v0.0.4
go: downloading github.com/armon/go-radix v1.0.0
go: downloading github.com/mattn/go-runewidth v0.0.8
go: extracting github.com/fatih/color v1.9.0
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/mattn/go-isatty v0.0.12
go: extracting github.com/armon/go-radix v1.0.0
go: extracting gopkg.in/yaml.v2 v2.2.8
go: extracting github.com/lib/pq v1.3.0
go: downloading github.com/mattn/go-colorable v0.1.6
go: extracting github.com/mattn/go-runewidth v0.0.8
go: extracting github.com/mattn/go-isatty v0.0.12
go: extracting github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e
go: downloading golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527
go: extracting github.com/go-sql-driver/mysql v1.5.0
go: extracting github.com/mattn/go-colorable v0.1.6
go: extracting github.com/posener/complete v1.2.3
go: extracting golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527
go: extracting github.com/mattn/go-sqlite3 v2.0.3+incompatible