protoc-gen-gotemplate icon indicating copy to clipboard operation
protoc-gen-gotemplate copied to clipboard

Nothing happens

Open domgolonka opened this issue 4 years ago • 3 comments

$ ls templates/
enum.txt.tmpl
$ cat templates/enum.txt.tmpl 
This is static text
$ protoc -I. -I=../declarations/postmark-sender --gotemplate_out=debug=true:./test/ ../declarations/postmark-sender/postmark.proto
WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
	A future release of golang/protobuf will delete this package,
	which has long been excluded from the compatibility promise.

$ ls test/

I also tried to put the template directory in: $ protoc -I. -I=../declarations/postmark-sender --gotemplate_out=template_dir=templates,debug=true:test ../declarations/postmark-sender/*.proto WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated. A future release of golang/protobuf will delete this package, which has long been excluded from the compatibility promise.

$ ls test/

I also tried to put the template directory and output directory in:

$ protoc -I=../declarations/postmark-sender --gotemplate_out=template_dir=templates,debug=true,destination_dir=./test/:test ../declarations/postmark-sender/*.proto
WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
	A future release of golang/protobuf will delete this package,
	which has long been excluded from the compatibility promise.

$ ls test

domgolonka avatar Jul 08 '20 20:07 domgolonka

Hi @domgolonka,

Your usage is correct, I think this is due to a conflict with another package, can you send me the version of various deps: protoc, protoc-gen-go

How did you install protoc-gen-gotemplate?

moul avatar Jul 08 '20 21:07 moul

$ protoc --version libprotoc 3.12.3

I did these to install it. I had proto and proto- go get -u github.com/golang/protobuf/{proto,protoc-gen-go} go get -u moul.io/protoc-gen-gotemplate

domgolonka avatar Jul 08 '20 22:07 domgolonka

Old issue but adding my experience for others:

I encountered a similar problem and realized that by default protoc-gen-gotemplate does not process .proto files that don't contain a service -- I resolved this by adding the "all=true" option as shown in the README. If your .proto file doesn't contain a service, this is probably what's going on.

tgorton617 avatar Dec 17 '20 17:12 tgorton617