Cannot find package “google/protobuf”

0 votes

I am compiling an open source project written in go (openblockchain). I get the following error when I do go build. Can anyone help me with this issue

Compilation Error

> go build
../go/src/github.com/openblockchain/obc-peer/openchain/util/utils.go:28:2: cannot find package "google/protobuf" in any of:
    /usr/src/pkg/google/protobuf (from $GOROOT)
    /home/vichu/go/src/google/protobuf (from $GOPATH)

Additional Information

I referred the question here in Stack Overflow but still no luck in solving the issue. Here is some more information about what all I have:

Protoc version is up to date.

> protoc --version 
libprotoc 3.0.0

My environment variables

> echo $GOPATH
/home/vichu/go
> echo $GOBIN
/home/vichu/go/bin

Protobuf has been built using the README.

~/go/src/github.com/golang/protobuf$ ls
AUTHORS  CONTRIBUTORS  jsonpb  LICENSE  Makefile  Make.protobuf  proto  protoc-gen-go  proto.pb.go  ptypes  README.md

Update

I did the following Util.go in source code as mentioned in answer. The source code is open source and here is the link

-       gp "google/protobuf"
+       gp "github.com/google/protobuf"

When I do go get, the below is the error

 go get github.com/google/protobuf
can't load package: package github.com/google/protobuf: no buildable Go source files in /home/vichu/go/src/github.com/google/protobuf
Oct 1, 2018 in Blockchain by sabby
• 4,350 points
338 views

1 answer to this question.

0 votes

Firstly, your import is wrong, you are trying to import a C++ package, not a golang package. It needs to be:

import ("github.com/golang/protobuf/proto")

If you don't have this package installed already, you need to run from command line:

go get github.com/golang/protobuf/proto
answered Oct 1, 2018 by Perry
• 17,010 points

Related Questions In Blockchain

+2 votes
4 answers
0 votes
1 answer
0 votes
1 answer

Truffle init: Error: Cannot find module 'original-require'

I think you need to run this ...READ MORE

answered Oct 24, 2018 in Blockchain by Omkar
• 67,290 points
126 views
0 votes
4 answers

Hyperledger fabric: enrollAdmin.js Error: Cannot find module 'fabric-client'

Change your directory to fabric-samples/fabrcar. And run: npm ...READ MORE

answered Nov 21, 2018 in Blockchain by Omkar
• 67,290 points
909 views
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
121 views
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

How to input realtime data from google sheets into urlfetch google scripts?

Based on your title I hope to ...READ MORE

answered Oct 12, 2018 in Blockchain by Perry
• 17,010 points
63 views