Skip to content

Instantly share code, notes, and snippets.

@pkqk
Created April 11, 2018 09:19
Show Gist options
  • Save pkqk/17f3f3f87d526ec667f0aea9c017164d to your computer and use it in GitHub Desktop.
Save pkqk/17f3f3f87d526ec667f0aea9c017164d to your computer and use it in GitHub Desktop.
timestamp/protobuf question
version: "3"
services:
go:
build: .
working_dir: /go/src
volumes:
- .:/go/src
command: protoc --go_out=. eg.proto
FROM golang:alpine
RUN apk add --no-cache git make protobuf
RUN go get github.com/golang/protobuf/protoc-gen-go
syntax = "proto3";
package eg;
import "google/protobuf/timestamp.proto";
message Timestamped {
google.protobuf.Timestamp stamp = 1;
int32 count = 2;
}
@pkqk
Copy link
Author

pkqk commented Apr 11, 2018

What should I do to get it to reference the google.protobuf.Timestamp definition?

Running protoc --go_out=. eg.proto current gives this error:

$ docker-compose run go
google/protobuf/timestamp.proto: File not found.
eg.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
eg.proto:8:3: "google.protobuf.Timestamp" is not defined.

I've scanned the entire filesystem of that image and timestamp.proto doesn't exist anywhere on it, does it need other packages and command line arguments

@chaitan94
Copy link

Doing an apk add protobuf-dev will fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment