dsvbtgo639708 2016-04-11 05:26 采纳率: 0%
浏览 318

找不到软件包“ google / protobuf”

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
  • 写回答

2条回答 默认 最新

  • doufei8250 2016-04-11 15:44
    关注

    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
    
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么