Go 未定义的从属于同一项目的单独包导入

Go 未定义的从属于同一项目的单独包导入,go,protocol-buffers,importerror,Go,Protocol Buffers,Importerror,以下是GitHub上的项目/回购的结构: |-grpc_definitions |--v0 |---myservice.pb.go |---myservice.proto |-api 我分岔了这个项目,在本地添加了一些东西;以下是新结构: |-grpc_definitions |--v0 |---myservice.pb.go |---myservice.proto |---new_service.pb.go |---new_service.proto |-api |--myservice.g

以下是GitHub上的项目/回购的结构:

|-grpc_definitions
|--v0
|---myservice.pb.go
|---myservice.proto
|-api
我分岔了这个项目,在本地添加了一些东西;以下是新结构:

|-grpc_definitions
|--v0
|---myservice.pb.go
|---myservice.proto
|---new_service.pb.go
|---new_service.proto
|-api
|--myservice.go
api/myservice.go
中,我导入grpc定义:

包api
导入grpc_定义_v0“github.com///grpc_定义/v0”
var s grpc_definitions_v0.NewServiceServer//此行未编译
var ss grpc_definitions_v0.ServiceServer//这一行很好
go.mod
对于
api

module github.com///api
去1.14
要求(
github.com///grpc_定义v0.0.0-20200723024905-6c479f56d135
...
)
如果我查看
new_service.pb.go
,就会定义
NewServiceServer
,它是正确包的一部分。它导入了所有已经存在的东西,只是我添加的东西没有正确导入

如果我转到
grpc\u definitions\u v0.ServiceServer
的定义,它似乎导入了
grpc\u definitions\u v0
的特定提交,而不是本地文件

如何让代码导入我添加/更改的文件


编辑:我尝试从提交中获取
go
,其中包含我的更改,但由于我正在处理一个repo分支,它说:
模块将其路径声明为:github.com///grpc\u definitions,但必须声明为:github.com///grpc\u definitions
我通过在终端中使用
replace
for
go mod
修复了这个问题:

$go mod edit-replace=“github.com///grpc\u定义=///grpc\u定义”

这意味着它需要使用本地文件。更多信息请参见:

“它似乎正在导入grpc_定义_v0的特定提交,而不是本地文件”--这是什么意思?请举个例子。@Flimzy我的意思是,如果我在IDE中按照“转到定义”链接从
grpc\u definitions\u v0
正确导入的内容,那么它会将我带到工作项目之外没有我的更改的文件(可能是从
go.mod
文件中导入的提交)