我在路径中创建了以下 .proto 文件:microservice/internal/proto-files/domain/repository.proto
syntax = "proto3";
package domain;
option go_package = "microservice/internal/gRPC/domain";
message Repository {
int64 id = 1;
string name = 2;
int64 userId = 3;
bool isPrivate = 4;
}
并在另一个路径中关注 .proto 文件:microservice/internal/proto-files/service
syntax = "proto3";
package service;
option go_package = "microservice/internal/gRPC/service";
import "microservice/internal/proto-files/domain/repository.proto";
//RepositoryService Definition
service RepositoryService {
rpc add (domain.Repository) returns (AddRepositoryResponse);
}
message AddRepositoryResponse {
domain.Repository addedRepository = 1;
Error error = 2;
}
message Error {
string code = 1;
string message = 2;
}
但是我的 IDE(goland) 无法解析 repository-service.proto 中的导入,并且当我使用 protoc 命令生成 .pb.go 文件时,我将面临以下错误:
microservice/internal/proto-files/domain/repository.proto: File not found.
拉风的咖菲猫
达令说
相关分类