我一直在尝试在 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如下:apiapi/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。
1 回答
慕丝7291255
TA贡献1859条经验 获得超6个赞
刚刚意识到我在代码中犯的复制/粘贴错误。
import (
"github.com/aws/aws-sdk-go/aws/service/s3"
"github.com/aws/aws-sdk-go/aws/service/s3/s3manager"
)
代替
import (
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
- 1 回答
- 0 关注
- 124 浏览
添加回答
举报
0/150
提交
取消