我无法为go编译google的fhir proto
1.我能够生成带有可以解决的警告的annotations.pb.go
protoc --proto_path=proto --go_out=. proto/annotations.proto
2020/05/27 12:42:17 WARNING: Missing 'go_package' option in "annotations.proto",
please specify it with the full Go package path as
a future release of protoc-gen-go will require this be specified.
See https://developers.google.com/protocol-buffers/docs/reference/go-generated#package for more information.2.不幸的是,我无法解决未找到文件的修复问题。
示例包含以下导入的profile_config.proto
import "proto/annotations.proto";
import "proto/r4/core/codes.proto";
import "proto/r4/core/datatypes.proto";尝试执行会导致“找不到”
protoc --proto_path=proto --go_out=. proto/profile_config.proto
proto/annotations.proto: File not found.
proto/r4/core/codes.proto: File not found.
proto/r4/core/datatypes.proto: File not found.也许这些原型文件只能与java一起使用,而任何其他语言都需要对这些文件进行修改。
发布于 2020-05-30 04:09:21
关于1.,您需要编辑您想要编译的每个.proto并添加go_package选项。例如:
option go_package = "github.com/my-org/my-proj/go/gen/fhir/proto"关于2.,您正在设置--proto_path=proto,这将导致protoc在以下路径中搜索proto/annotations.proto:
./proto/proto/annotations.proto如果不设置此选项或将其设置为--proto_path=.,则可以进行编译。
我还建议你看看this pull-request。
https://stackoverflow.com/questions/62048665
复制相似问题