我一直在尝试在 Go v1.13 上构建一个模块,该模块依赖于github.com/aws/aws-lambda-go并且github.com/aws/aws-sdk-go在两个导入上失败:
"github.com/aws/aws-sdk-go/aws/service/s3"
"github.com/aws/aws-sdk-go/aws/service/s3/s3manager"
目录包含我的模块定义GOOS=linux GOARCH=amd64 go build -o dist/api ./api的stderr如下:api
api/main.go:11:2: cannot find package "github.com/aws/aws-sdk-go/aws/service/s3" in any of:
/usr/local/go/src/github.com/aws/aws-sdk-go/aws/service/s3 (from $GOROOT)
/u/go/src/github.com/aws/aws-sdk-go/aws/service/s3 (from $GOPATH)
api/main.go:12:2: cannot find package "github.com/aws/aws-sdk-go/aws/service/s3/s3manager" in any of:
/usr/local/go/src/github.com/aws/aws-sdk-go/aws/service/s3/s3manager (from $GOROOT)
/u/go/src/github.com/aws/aws-sdk-go/aws/service/s3/s3manager (from $GOPATH)
老实说,我不知道为什么会发生这种情况,任何投入都将不胜感激。
已经尝试使用go get以确保已提取依赖项:
$ go get github.com/aws/aws-sdk-go
并且请求的导入路径存在于$GOPATH/src/github.com/aws/aws-sdk/go/aws/service/s3和$GOPATH/src/github.com/aws/aws-sdk/go/aws/service/s3/s3manager
此外,尝试go clean --cache --modcache在删除先前拉取的模块的同时使用清除缓存。
仔细检查,我完全忽略了一些东西,导入路径/u/go/src/github.com/aws/aws-sdk-go/aws/service/s3而不是/u/go/src/github.com/aws/aws-sdk-go/service/s3前者在aws内部有一个额外的子路径aws-sdk-go。
慕丝7291255
相关分类