我的项目中具有这样的原型文件结构
$ tree -L 3 proto
proto
└── namespace
├── one
│ └── one.proto
├── two
│ └── two.proto
└── prototool.yaml
这是我的prototoo.yaml
的样子
protoc:
version: 3.6.1
includes:
- /usr/include
allow_unused_imports: true
lint:
group: uber2
break:
include_beta: true
allow_beta_deps: true
generate:
go_options:
import_path: proto/namespace
plugins:
- name: go
type: go
flags: plugins=grpc
output: ../../gen/go/proto/namespace
我使用docker run -v /Users/name/repos/project:/work uber/prototool:latest prototool generate proto/namespace
从此原始文件生成了go代码
一切正常,但是当我进行构建时,出现此错误
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -o project cmd/namespace/main.go;
build command-line-arguments: cannot load gen/go/proto/namespace/one: cannot find module providing package gen/go/proto/namespace/one
make: *** [build] Error 1
我在这里想念的是什么?为什么我无法在main.go
中导入生成的文件?