duandanai6470 2018-12-04 01:50
浏览 83
已采纳

Go模块-无法访问本地软件包?

So, I'm new to Go. I've created a go.mod file

module github.com/austin/test-project <--- This is all I've added to the go.mod

I added a tag v0.0.1 to my commit latest git commit.

Based on some examples I tried to understand, I added these imports to my go file(s), where common is one package, dynamo is another, and the import is from a third package called 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"

And here is my output after running go build ./handler/characterstate where the main go file is:

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

The go.mod file is now this:

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
)

... and I have a characterstate.exe at the root, and the expected go.sum

In my IDE, GoLand, the import paths for my local common and dynamo packages are still highlighted red.

I've been searching all day, and I've got no idea what's going on. Where am I going wrong? Could it be that the git repo is private that I'm trying to

Thanks in advance. Hope to hear from someone soon :)

  • 写回答

1条回答 默认 最新

  • douwojiao5919 2018-12-05 22:45
    关注

    Simply and outdated IDE. Once updated to a version that supported Go 1.11, I no longer saw the red error text on import.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度