Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protobuf import google/protobuf/timestamp.proto

My proto file is:

syntax = "proto3";

import "google/protobuf/timestamp.proto";

service Foo {
  rpc now(NowRequest) returns (NowResponse) {}
}

message NowRequest {}

message NowResponse {
  google.protobuf.Timestamp now = 1;
}

My command to generate code and the resulting error is:

protoc foo.proto --go_out=plugins=grpc,import_path=proto:internal/proto
foo.proto:3:1: Import "google/protobuf/timestamp.proto" was not found or had errors.
foo.proto:12:3: "google.protobuf.Timestamp" is not defined.

My protoc version is:

protoc --version
libprotoc 3.11.3

I have followed this guide and reviewed this question. How can I import well known types? Do I need to download anything else? How can I tell what are the exact well known types for my current installation? Thank you.

like image 929
user2133814 Avatar asked Feb 15 '20 15:02

user2133814


1 Answers

"google/protobuf/timestamp.proto" gets stored in the path : /usr/local/include/google/protobuf

Please check if you have /usr/local/include/google/protobuf directory.

If not, this means there is an error in protobuf installation. Please retrace the installation steps followed or try re-installing.

Please find more help here : https://github.com/grpc-ecosystem/grpc-gateway/issues/422

like image 174
Kartavya Ramnani Avatar answered Sep 27 '22 21:09

Kartavya Ramnani