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.

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

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里