2018-05-21 15:05 阅读 147


I am trying to import a package in my golang code. But it is showing me this error:

cannot find package "" in any of: /opt/go/src/ (from $GOROOT) /chaincode/input/src/ (from $GOPATH) /opt/gopath/src/ "

Can somebody help me fix this?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    duanjiaren8188 duanjiaren8188 2018-05-24 10:16

    Recheck your environment variables($GOPATH, $GOROOT).

    The problem you are facing is that, your code is searching for the package in /opt/go/src/, /chaincode/input/src/ and /opt/gopath/src/ directories. But you have installed the package in C:\Users\xyz\go\src\ directory.

    点赞 评论 复制链接分享
  • douxun3496 douxun3496 2018-05-21 15:08

    Ensure your $GOPATH environment variable is set up correctly.

    Then double check the packages are installed, if not you need to install the package which you can do with.

    go get

    点赞 评论 复制链接分享