Posted at

dep ensureでbuild.NoGoErrorが出た場合

github.com/aws/aws-xray-sdk-goをdepを使って取り込もうとし、READMEに従いdep ensureコマンドを入力したら下記エラーに出くわした。

$ dep ensure -add github.com/aws/aws-xray-sdk-go

Fetching sources...

Solving failure: No versions of github.com/aws/aws-xray-sdk-go met constraints:
v0.9.4: Could not introduce github.com/aws/aws-xray-sdk-go@v0.9.4, as its subpackage github.com/aws/aws-xray-sdk-go does not contain usable Go code (*build.NoGoError).. (Package is required by (root).)

これはgithub.com/aws/aws-xray-sdk-goの配下に.goファイルが見つからないためエラーになっている模様。

.goファイルが入っているpackageを指定したらエラーなく取り込めた

$ dep ensure -add github.com/aws/aws-xray-sdk-go/xray                                                                                                   

Fetching sources...

"github.com/aws/aws-xray-sdk-go/xray" is not imported by your project, and has been temporarily added to Gopkg.lock and vendor/.
If you run "dep ensure" again before actually importing it, it will disappear from Gopkg.lock and vendor/.