gpt4 book ai didi

amazon-web-services - 没有必需的模块提供包 github.com/aws/aws-sdk-go/aws

转载 作者:行者123 更新时间:2023-12-02 18:38:54 24 4
gpt4 key购买 nike

为什么我会收到此错误消息?我是使用 aws sam 和 Go 的初学者。

Error: GoModulesBuilder:Build - Builder Failed: main.go:9:2: no required module provides package github.com/aws/aws-sdk-go/aws; to add it:
go get github.com/aws/aws-sdk-go/aws
main.go:10:2: no required module provides package github.com/aws/aws-sdk-go/aws/session; to add it:
go get github.com/aws/aws-sdk-go/aws/session
main.go:11:2: no required module provides package github.com/aws/aws-sdk-go/service/dynamodb; to add it:<br>
go get github.com/aws/aws-sdk-go/service/dynamodb

这是我在 vscode 中的代码包主

import (
"logs"

"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
)

最佳答案

您需要正确设置您的 Go 项目以进行依赖管理。首先按照 Tutorial: Get started with Go 中描述的初始化项目的步骤进行操作:

go mod init YOUR_PROJECT_NAME

然后添加你的依赖:

go get github.com/aws/aws-sdk-go/aws
go get github.com/aws/aws-sdk-go/service/dynamodb

关于amazon-web-services - 没有必需的模块提供包 github.com/aws/aws-sdk-go/aws,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68339851/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com