所以,我是Go的新手。我创建了一个go.mod文件
module github.com/austin/test-project
<---这就是我添加到go.mod中的全部内容
我在最新的git commit中添加了标签v0.0.1。
基于一些我试图理解的示例,我将这些导入添加到了go文件中,其中 common 是一个软件包, dynamo 是另一个软件包,导入来自名为 main 的第三个程序包。
import (
"github.com/austin/test-project/common"
"github.com/austin/test-project/db/dynamo/playerstateddb"
"github.com/austin/test-project/db/dynamo/characterstateddb"
"context"
"fmt"
"encoding/json"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-lambda-go/events"
这是我运行go build ./handler/characterstate
后的输出,其中 main go文件是:
go: finding github.com/aws/aws-lambda-go/events latest
go: finding github.com/aws/aws-lambda-go/lambda latest
go: finding github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute latest
go: finding github.com/aws/aws-sdk-go/service/dynamodb latest
go: finding github.com/aws/aws-sdk-go/aws latest
go: finding github.com/aws/aws-sdk-go/aws/session latest
go: finding github.com/aws/aws-lambda-go v1.7.0
go: downloading github.com/aws/aws-lambda-go v1.7.0
go: finding github.com/aws/aws-sdk-go/service latest
go: finding github.com/aws/aws-sdk-go v1.15.89
go: downloading github.com/aws/aws-sdk-go v1.15.89
go: finding github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: downloading github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go.mod文件现在是这样:
module github.com/carbonated-dev/madworld-backend
require (
github.com/aws/aws-lambda-go v1.7.0
github.com/aws/aws-sdk-go v1.15.89
)
...并且我在根目录下有一个characterstate.exe,以及预期的go.sum
在我的IDE GoLand中,本地 common 和 dynamo 程序包的导入路径仍突出显示为红色。
我整天都在搜索,但不知道发生了什么。我要去哪里错了?
可能是git repo是私有的先谢谢了。希望很快能收到别人的来信:)
答案 0 :(得分:0)
简单而过时的IDE。更新到支持Go 1.11的版本后,我再也看不到导入时的红色错误文本。