aws-sdk-go 的构建依赖项在 Go 版本 1.13 上失败
Build dependencis for aws-sdk-go fails on Go version 1.13
我一直在尝试在 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
的标准错误如下,其中 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-sdk-go
中有一个额外的 aws
子路径。
刚刚意识到我在代码中犯的 copy/paste 错误。
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"
)
我一直在尝试在 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
的标准错误如下,其中 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-sdk-go
中有一个额外的 aws
子路径。
刚刚意识到我在代码中犯的 copy/paste 错误。
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"
)