go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 not working

329 views
Skip to first unread message

James Brooke

unread,
Jul 22, 2022, 4:48:27 PM7/22/22
to golang-nuts
Hello, I'm struggling to work out why this isn't working. I'm getting the following, any help greatly appreciated.

../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:14:2: package bufio is not in GOROOT (/usr/local/go/src/bufio)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:15:2: package bytes is not in GOROOT (/usr/local/go/src/bytes)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/impl/legacy_file.go:9:2: package compress/gzip is not in GOROOT (/usr/local/go/src/compress/gzip)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/detrand/rand.go:13:2: package encoding/binary is not in GOROOT (/usr/local/go/src/encoding/binary)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/impl/legacy_export.go:9:2: package encoding/json is not in GOROOT (/usr/local/go/src/encoding/json)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/main.go:13:2: package errors is not in GOROOT (/usr/local/go/src/errors)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/main.go:14:2: package flag is not in GOROOT (/usr/local/go/src/flag)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/main.go:15:2: package fmt is not in GOROOT (/usr/local/go/src/fmt)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/internal_gengo/main.go:10:2: package go/ast is not in GOROOT (/usr/local/go/src/go/ast)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/internal_gengo/main.go:11:2: package go/parser is not in GOROOT (/usr/local/go/src/go/parser)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:19:2: package go/printer is not in GOROOT (/usr/local/go/src/go/printer)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/cmd/protoc-gen-go/internal_gengo/main.go:12:2: package go/token is not in GOROOT (/usr/local/go/src/go/token)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:21:2: package go/types is not in GOROOT (/usr/local/go/src/go/types)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/impl/legacy_export.go:10:2: package hash/crc32 is not in GOROOT (/usr/local/go/src/hash/crc32)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/detrand/rand.go:14:2: package hash/fnv is not in GOROOT (/usr/local/go/src/hash/fnv)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/encoding/protowire/wire.go:13:2: package io is not in GOROOT (/usr/local/go/src/io)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/impl/legacy_file.go:10:2: package io/ioutil is not in GOROOT (/usr/local/go/src/io/ioutil)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/encoding/protowire/wire.go:14:2: package math is not in GOROOT (/usr/local/go/src/math)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/encoding/protowire/wire.go:15:2: package math/bits is not in GOROOT (/usr/local/go/src/math/bits)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/detrand/rand.go:15:2: package os is not in GOROOT (/usr/local/go/src/os)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:24:2: package path is not in GOROOT (/usr/local/go/src/path)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/compiler/protogen/protogen.go:25:2: package path/filepath is not in GOROOT (/usr/local/go/src/path/filepath)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/proto/equal.go:10:2: package reflect is not in GOROOT (/usr/local/go/src/reflect)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/encoding/text/decode.go:11:2: package regexp is not in GOROOT (/usr/local/go/src/regexp)
package google.golang.org/protobuf/cmd/protoc-gen-go: cannot find package
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/order/range.go:9:2: package sort is not in GOROOT (/usr/local/go/src/sort)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/reflect/protoreflect/source.go:8:2: package strconv is not in GOROOT (/usr/local/go/src/strconv)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/reflect/protoreflect/proto.go:131:2: package strings is not in GOROOT (/usr/local/go/src/strings)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/pragma/pragma.go:9:8: package sync is not in GOROOT (/usr/local/go/src/sync)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/filedesc/desc.go:11:2: package sync/atomic is not in GOROOT (/usr/local/go/src/sync/atomic)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/strs/strings.go:11:2: package unicode is not in GOROOT (/usr/local/go/src/unicode)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/encoding/text/decode_string.go:12:2: package unicode/utf16 is not in GOROOT (/usr/local/go/src/unicode/utf16)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/internal/strs/strings.go:12:2: package unicode/utf8 is not in GOROOT (/usr/local/go/src/unicode/utf8)
../../../go/pkg/mod/google.golang.org/prot...@v1.28.0/reflect/protoreflect/value_unsafe.go:11:2: package unsafe is not in GOROOT (/usr/local/go/src/unsafe)

Kurtis Rader

unread,
Jul 22, 2022, 8:22:53 PM7/22/22
to James Brooke, golang-nuts
On Fri, Jul 22, 2022 at 9:48 AM James Brooke <jamesbr...@gmail.com> wrote:
Hello, I'm struggling to work out why this isn't working. I'm getting the following, any help greatly appreciated.

It would help if you explained what you did that produced those error messages. You should probably also include the output of `go env` given the reference to GOROOT.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/f946128f-4748-475f-9dc1-782aa1ca1d5dn%40googlegroups.com.


--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

James Brooke

unread,
Jul 23, 2022, 1:03:22 AM7/23/22
to golang-nuts
Thank you for your reply Kurtis. In answer to your questions:

- I simply tried to run that command in the terminal. I'm able to develop go programs fine in GoLand, pulling in 3rd party dependencies etc. I just can't seem to install this binary because of this GOROOT issue.
- this is the output from go env:

GO111MODULE="on"
GOARCH="amd64"
GOBIN="/Users/XXXX/go/bin"
GOCACHE="/Users/XXXX/Library/Caches/go-build"
GOENV="/Users/XXXX/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/XXXX/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/XXXX/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hq/0vgn198d7v5_kkhc5y8bz8r40000gq/T/go-build3791061883=/tmp/go-build -gno-record-gcc-switches -fno-common"

From what I can recall I installed go on my mac with homebrew if that's any help. Thanks again for your reply and hopefully you have some insight for me.

Kurtis Rader

unread,
Jul 23, 2022, 1:13:40 AM7/23/22
to James Brooke, golang-nuts
On Fri, Jul 22, 2022 at 6:03 PM James Brooke <jamesbr...@gmail.com> wrote:
- I simply tried to run that command in the terminal. I'm able to develop go programs fine in GoLand, pulling in 3rd party dependencies etc. I just can't seem to install this binary because of this GOROOT issue.

What command did you run? You wrote "Hello, I'm struggling to work out why this isn't working. I'm getting the following, any help greatly appreciated." followed by a bunch of error messages. Nowhere do I see the actual command(s) you ran that resulted in those errors. Also, your GOROOT="/usr/local/Cellar/go/1.18/libexec" is suspicious. It might be correct for a Homebrew installed version of Go but that "libexec" path component is weird. Did you set GOROOT in your environment? If you did so does unsetting it resolve this issue?

James Brooke

unread,
Jul 24, 2022, 12:22:49 AM7/24/22
to golang-nuts
Thanks again for following up on this Kurtis. The command is in the subject line: "go install google.golang.org/protobuf/cmd/protoc...@v1.28 not working". Apologies if that wasn't clear.

I'm finding this confusing to say the least. Without any further changes to my system, and not heading the advice that trying the same thing and expecting a different result is a sign of madness, I've now run the command in the terminal without errors. Hmmm... Anyway, from my perspective I've got everything I needed to get working working now. Thanks for your input.

TheDiveO

unread,
Jul 24, 2022, 6:22:21 AM7/24/22
to golang-nuts
GOMOD="/dev/null" either looks weird or there is something interesting new to learn here.
Reply all
Reply to author
Forward
0 new messages