# Distributed Services With Go - gogoproto on linux

**URL:** <https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823>\
**Category:** PragProg Customers\
**Tags:** book-distributed-services-with-go, errata\
**Created:** [15 June 2020 13:40 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823 "2020-06-15T13:40:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![abtin](https://forum.devtalk.com/user_avatar/forum.devtalk.com/abtin/32/671_2.png) [@abtin](https://forum.devtalk.com/u/abtin)\
**Post date:** [15 June 2020 13:40 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/1 "2020-06-15T13:40:57Z")

</div>

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:

```auto
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](https://github.com/gogo/protobuf/tree/master)

---

<div class="post-metadata">

**Author:** ![seblegall](https://forum.devtalk.com/user_avatar/forum.devtalk.com/seblegall/32/1002_2.png) [@seblegall](https://forum.devtalk.com/u/seblegall)\
**Post date:** [15 June 2020 21:03 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/2 "2020-06-15T21:03:42Z")

</div>

Hi,

I work on a mac and I had to use this command :

```auto
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 :

```auto
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](https://github.com/gogo/protobuf/blob/master/README)) descripting usage as

```auto
protoc --gogo_out=. -I=.:github.com/gogo/protobuf/protobuf *.proto

```

---

<div class="post-metadata">

**Author:** ![travisjeffery](https://forum.devtalk.com/user_avatar/forum.devtalk.com/travisjeffery/32/525_2.png) [@travisjeffery](https://forum.devtalk.com/u/travisjeffery)\
**Post date:** [19 June 2020 05:49 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/3 "2020-06-19T05:49:56Z")

</div>

You didn’t have the second beta right? I believe I fixed this.

---

<div class="post-metadata">

**Author:** ![youshy](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/y/9d8465/32.png) [@youshy](https://forum.devtalk.com/u/youshy)\
**Post date:** [3 July 2020 09:54 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/4 "2020-07-03T09:54:18Z")

</div>

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:

```auto
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;
}

```

---

<div class="post-metadata">

**Author:** ![travisjeffery](https://forum.devtalk.com/user_avatar/forum.devtalk.com/travisjeffery/32/525_2.png) [@travisjeffery](https://forum.devtalk.com/u/travisjeffery)\
**Post date:** [7 July 2020 03:16 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/5 "2020-07-07T03:16:23Z")

</div>

I’m on Linux. Just double checked on Linux and Mac and both worked.

```auto
# I've deleted all protoc-gen-go* executables to check that it fails.
[tj@computer ServeRequestsWithgRPC]$ protoc api/v1/*.proto \
--gogo_out=Mgogoproto/gogo.proto=github.com/gogo/protobuf/proto:. \
--proto_path=$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) \
--proto_path=.
protoc-gen-gogo: 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
--gogo_out: protoc-gen-gogo: Plugin failed with status code 1.
# I install the executables.
[tj@computer ServeRequestsWithgRPC]$ go get github.com/gogo/protobuf/...@v1.3.1
# Check that it can find the executable and succeeds.
[tj@computer ServeRequestsWithgRPC]$ protoc api/v1/*.proto --gogo_out=Mgogoproto/gogo.proto=github.com/gogo/protobuf/proto:. --proto_path=$(go list -f '{{ .Dir }}' -m github.com/gogo/protobuf) --proto_path=.
[tj@computer ServeRequestsWithgRPC]$ # worked

```

Maybe something is up with your PATH so the executables aren’t found or something.

---

<div class="post-metadata">

**Author:** ![alexanderhansen](https://forum.devtalk.com/user_avatar/forum.devtalk.com/alexanderhansen/32/1209_2.png) [@alexanderhansen](https://forum.devtalk.com/u/alexanderhansen)\
**Post date:** [8 October 2020 04:26 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/6 "2020-10-08T04:26:09Z")

</div>

I was running in to similar problems and created a VS Code Dev Container to make it reproducible:

> **[alexanderhansen/proglog](https://github.com/alexanderhansen/proglog)**
>
> Contribute to alexanderhansen/proglog development by creating an account on GitHub.

protoc won’t compile, resulting in error:

$(go list -f ‘{{ .Dir }}’ -m [github.com/gogo/protobuf](http://github.com/gogo/protobuf)): warning: directory does not exist. gogoproto/gogo.proto: File not found. api/v1/log.proto:5:1: Import “gogoproto/gogo.proto” was not found or had errors.

Where gogo.proto is actually there but has errors.

---

<div class="post-metadata">

**Author:** ![gavinc95](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/g/c6cbf5/32.png) [@gavinc95](https://forum.devtalk.com/u/gavinc95)\
**Post date:** [11 October 2020 06:34 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/7 "2020-10-11T06:34:08Z")

</div>

I was having the same issue (on Arch Linux), and it turned out to be a permission issue. Make sure you have permission to run the protoc executable, and check the permissions for your working directory.

---

<div class="post-metadata">

**Author:** ![travisjeffery](https://forum.devtalk.com/user_avatar/forum.devtalk.com/travisjeffery/32/525_2.png) [@travisjeffery](https://forum.devtalk.com/u/travisjeffery)\
**Post date:** [16 October 2020 05:21 UTC](https://forum.devtalk.com/t/distributed-services-with-go-gogoproto-on-linux/823/8 "2020-10-16T05:21:10Z")

</div>

Hey y’all, I’ve switched the book to use [github.com/golang/protobuf](http://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](https://github.com/gogo/protobuf/issues/691). This update will be in a subsequent beta release.
