23
10

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 5 years have passed since last update.

go buildでcannot find packageのエラーとなった時

Posted at

環境

  • go1.13.1

エラーメッセージ例

../../go/src/github.com/hoge/fuga/piyo.go:7:8: cannot find package "golang.org/x/sys/unix" in any of:
        /usr/local/Cellar/go/1.13.1/libexec/src/golang.org/x/sys/unix (from $GOROOT)
        /Users/(username)/go/src/golang.org/x/sys/unix (from $GOPATH)

依存するパッケージ(この例ではgolang.org/x/sys/unix)が$GOROOT$GOPATHから見つからず、ビルドに失敗している。

対処

該当のパッケージをgo getする。

$ go get -u golang.org/x/sys/unix

その後、go buildする。

23
10
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
23
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?