
abtin
Distributed Services With Go - gogoproto on linux
page 20: … protoc command…
I had to additionally run the following go get
commands in order to be able to compile protobuf code using gogo protobuf on a linux machine:
go get github.com/gogo/protobuf/proto
go get github.com/gogo/protobuf/jsonpb
go get github.com/gogo/protobuf/protoc-gen-gogo
go get github.com/gogo/protobuf/gogoproto
I don’t use Mac but it would be nice to mention that the setup on linux is different or point the readers to the git repo for installation instruction. https://github.com/gogo/protobuf/tree/master
Marked As Solved

travisjeffery
Hey y’all, I’ve switched the book to use github.com/golang/protobuf because of the release of Go’s protobuf APIv2, gogoprotobuf lacking ownership and projects moving away from using gogoprotobuf: https://github.com/gogo/protobuf/issues/691. This update will be in a subsequent beta release.
Also Liked

youshy
I’m on the second beta right now, sadly the problem still exists (I’m on Linux).
Used this command to fix:
protoc --gogoslick_out=. -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/gogoproto *.proto
also my log.proto
is updated:
syntax = "proto3";
package log.v1;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.sizer_all) = true;
message Record {
bytes value = 1;
uint64 offset = 2;
}

seblegall
Hi,
I work on a mac and I had to use this command :
protoc api/v1/*.proto \
--gogoslick_out=plugins=grpc:. \
--proto_path=$$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) \
--proto_path=.
Notice the gogoslick_out
flag. I had to use that instead of the gogo_out
flag described in the book.
The readme file says :
protoc-gen-gogofast (same as gofast, but imports gogoprotobuf)
protoc-gen-gogofaster (same as gogofast, without XXX_unrecognized, less pointer fields)
protoc-gen-gogoslick (same as gogofaster, but with generated string, gostring and equal methods)
But indeed, I didn’t saw the last paragraph “Most Speed and most customization” describing the command you suggest.
So I guess, it’s not a matter of Mac or Linux. Maybe the gogo/protobuf changed is usage ?
To be fair, there is an old README in the git repo (https://github.com/gogo/protobuf/blob/master/README) descripting usage as
protoc --gogo_out=. -I=.:github.com/gogo/protobuf/protobuf *.proto

travisjeffery
You didn’t have the second beta right? I believe I fixed this.
Popular Prag Prog topics









Modern front-end development for Rails, second edition - Struggling to get the first chapter to work

Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /rust
- /erlang
- /ruby
- /opensuse
- /phoenix
- /python
- /kotlin
- /rails
- /wasm
- /clojure
- /keyboards
- /react
- /go
- /security
- /js
- /centos
- /react-native
- /typescript
- /vim
- /swift
- /haskell
- /svelte
- /quarkus
- /emacs
- /debian
- /v
- /tailwind
- /vapor
- /gleam
- /django
- /nodejs
- /crystal
- /arch-linux
- /assemblyscript
- /kubuntu
- /c-plus-plus
- /fable
- /vscode
- /flutter
- /java
- /deno
- /laravel
- /symfony
- /agda
- /nixos
- /scala
- /actix
- /julia
- /ocaml
- /elm
- /ubuntu
- /manjaro
- /slackware
- /zig
- /spring
- /angular
- /preact
- /html
- /nerves