2

I am trying out go-micro and I have issues genearating .micro boilerplate code. I have set my env and even passed the direct directory of my GOPATH but got error

/Users/Olar/home/golib/bin/protoc-gen-micro: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --micro_out: protoc-gen-micro: Plugin failed with status code 1.

the command I run

protoc --plugin=protoc-gen-go=/Users/Olar/home/golib/bin/protoc-gen-go --plugin=protoc-gen-micro=/Users/Olar/home/golib/bin/protoc-gen-micro --proto_path=/Users/Olar/home/golib/src:. --go_out=. --micro_out=. greeter.proto

on removal of --micro_out=., greeter.pb.go file is generated but the .micro is not generated. How can I fix this

King
  • 1,885
  • 3
  • 27
  • 84

2 Answers2

1

You must have protoc and the plugin (protoc-gen-micro) installed.

I think you omitted the second step.

See:

https://github.com/micro/protoc-gen-micro

And perhaps:

go get github.com/micro/protoc-gen-micro

And then:

which protoc-gen-micro
DazWilkin
  • 32,823
  • 5
  • 47
  • 88
  • `which protoc-gen-micro` protoc-gen-micro not found – King Mar 01 '20 at 19:00
  • I opened another terminal and did `go get ...` then I got this error `package github.com/micro/protoc-gen-micro/v2: cannot find package "github.com/micro/protoc-gen-micro/v2" in any of: /usr/local/Cellar/go/1.14/libexec/src/github.com/micro/protoc-gen-micro/v2 (from $GOROOT) /Users/Olar/home/golib/src/github.com/micro/protoc-gen-micro/v2 (from $GOPATH)` – King Mar 01 '20 at 19:02
  • I just tried it and `go get github.com/micro/protoc-gen-micro` (omit the `/v2`) works for me and I can then `ls `${GOPATH}/bin/protoc-gen-micro` and `protoc` should then work – DazWilkin Mar 01 '20 at 19:02
  • go get github.com/micro/protoc-gen-micro go: module github.com/micro/protoc-gen-micro: git ls-remote -q origin in /Users/user1/go/pkg/mod/cache/vcs/28cfbca4f5e41691076780b2017d5a1000b007b1d3d37b7a9d3b562c7adc9377: exit status 128: remote: Repository not found. fatal: repository 'https://github.com/micro/protoc-gen-micro/' not found – Dat TT Aug 27 '22 at 07:00
0

l find protoc-gen-micro is under this :https://github.com/go-micro/generator, you can download it to local project and use it

eggsy
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 23 '23 at 12:08