Protobuf: How to install this offline?

Created on 31 May 2017  路  2Comments  路  Source: golang/protobuf

I have downloaded https://github.com/golang/protobuf/archive/master.zip, trying to install from source, but it seems I am not allowed to do that.

go install ./proto ./jsonpb ./ptypes
jsonpb/jsonpb.go:54:2: cannot find package "github.com/golang/protobuf/proto" in any of:
        /home/shell/pkg/go/src/github.com/golang/protobuf/proto (from $GOROOT)
        /home/shell/go/src/github.com/golang/protobuf/proto (from $GOPATH)
jsonpb/jsonpb.go:56:2: cannot find package "github.com/golang/protobuf/ptypes/struct" in any of:
        /home/shell/pkg/go/src/github.com/golang/protobuf/ptypes/struct (from $GOROOT)
        /home/shell/go/src/github.com/golang/protobuf/ptypes/struct (from $GOPATH)
ptypes/any.go:43:2: cannot find package "github.com/golang/protobuf/ptypes/any" in any of:
        /home/shell/pkg/go/src/github.com/golang/protobuf/ptypes/any (from $GOROOT)
        /home/shell/go/src/github.com/golang/protobuf/ptypes/any (from $GOPATH)
ptypes/duration.go:42:2: cannot find package "github.com/golang/protobuf/ptypes/duration" in any of:
        /home/shell/pkg/go/src/github.com/golang/protobuf/ptypes/duration (from $GOROOT)
        /home/shell/go/src/github.com/golang/protobuf/ptypes/duration (from $GOPATH)
ptypes/timestamp.go:41:2: cannot find package "github.com/golang/protobuf/ptypes/timestamp" in any of:
        /home/shell/pkg/go/src/github.com/golang/protobuf/ptypes/timestamp (from $GOROOT)
        /home/shell/go/src/github.com/golang/protobuf/ptypes/timestamp (from $GOPATH)
make: *** [install] Error 1

I know the Installation section in _README.rd_, but the instructions there requires Internet connection, which I do not have on that machine

Most helpful comment

We generally only use the issue tracker for filing issues, and not for asking general questions. The go-nuts group is a better place for this sort of question.

Assuming your $GOPATH is $HOME/go, you should extract the zip file into $HOME/go/src/github.com/golang/. You can then run go install github.com/golang/protobuf/protoc-gen-go, which will build and place the binary in $HOME/go/bin. You should add that path to your $PATH so that your system can find the binary.

Next you will need the protoc compiler itself. You can download a pre-built version from here. If you are on linux-amd64, you can select protoc-3.3.0-linux-x86_64.zip. You can extract the bin/protoc binary somewhere into your $PATH.

All 2 comments

We generally only use the issue tracker for filing issues, and not for asking general questions. The go-nuts group is a better place for this sort of question.

Assuming your $GOPATH is $HOME/go, you should extract the zip file into $HOME/go/src/github.com/golang/. You can then run go install github.com/golang/protobuf/protoc-gen-go, which will build and place the binary in $HOME/go/bin. You should add that path to your $PATH so that your system can find the binary.

Next you will need the protoc compiler itself. You can download a pre-built version from here. If you are on linux-amd64, you can select protoc-3.3.0-linux-x86_64.zip. You can extract the bin/protoc binary somewhere into your $PATH.

Good to know the go-nuts group
Thank you.

Was this page helpful?
0 / 5 - 0 ratings