1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

go install でハマったこと

Last updated at Posted at 2022-07-19

不覚にも go install でハマった。。。
結論、公式ドキュメント にちゃんと記載されているが、具体例が一切無く分かりにくい。
なので備忘録を残す。

バージョンが異なる複数のパッケージを同時にインストールできない

複数のパッケージをインストールする場合、全て同じバージョンを指定する必要がある。
そうしなければall arguments must have the same versionと言われる。。。

$ go install github.com/go-delve/delve/cmd/dlv@latest golang.org/x/tools/gopls@v0.9.1 
=> go: golang.org/x/tools/gopls@v0.9.1: all arguments must have the same version (@latest)

If the arguments have version suffixes (like @latest or @v1.0.0), "go install" builds packages in module-aware mode, ignoring the go.mod file in the current directory or any parent directory, if there is one.
(中略)
- All arguments must have the same version suffix. Different queries are not allowed, even if they refer to the same version.

異なるモジュールのパッケージを同時にインストールできない。

モジュールもバージョンも同じ必要がある。
そうしなければ、All packages must be provided by the same module と言われる。。。

$ go install github.com/go-delve/delve/cmd/dlv@latest github.com/cweill/gotests/gotests@latest
=> All packages must be provided by the same module (github.com/go-delve/delve@v1.9.0)

If the arguments have version suffixes (like @latest or @v1.0.0), "go install" builds packages in module-aware mode, ignoring the go.mod file in the current directory or any parent directory, if there is one.
(中略)
- All arguments must refer to packages in the same module at the same version.

解決策

面倒臭いが、個別にインストールするしかない。

$ go install golang.org/x/tools/gopls@v0.9.1
$ go install github.com/go-delve/delve/cmd/dlv@latest
$ go install gotest.tools/gotestsum@latest

うーん、、、汚い。。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?