doudao2407 2017-12-22 20:09
浏览 155
已采纳

使用自定义GOPATH和govendor在Golang IDE中没有stdlib搜索

I'm using Goland 2017.3 with Go 1.9.2, and have a custom GOPATH with govendor that replicates the DigitalOcean monorepo, as explained here: https://blog.digitalocean.com/cthulhu-organizing-go-code-in-a-scalable-repo/

The structure looks like this:

gocode
├── .env.sh
├── bin
├── src
│   └── acmecorp
│       ├── teams
│       └── vendor
├── pkg

and .env.sh looks like this:

SCRIPT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "${0}"`
GOCODE=$(dirname $SCRIPT)
export GOPATH="$GOCODE"
export PATH="$PATH:$GOPATH/bin"

I have no issue building code with source .env.sh and govendor build. govendor resolves all dependencies and builds the project.

However, when I attempt to set up GOPATH in GoLand and set PROJECT GOPATH to $HOME/gocode, GoLand stops recognizing the stdlib because it starts looking for the stdlib in vendor: $HOME/gocode/src/acmecorp/vendor/time has no buildable Go source files. If I remove the PROJECT GOPATH it finds the stdlib but not the code in the mono repo.

How can I get GoLand to stop looking in vendor for the stdlib?

Edit: GOROOT is kept as standard in the IDE: screenshot of GOROOT

  • 写回答

1条回答 默认 最新

  • drpp5680 2017-12-22 21:00
    关注

    Please open an issue on the tracker tracker https://youtrack.jetbrains.com/issues/Go and attach the IDE logs via Help | Collect and Show Logs in.... You can lock the visibility of the logs to jetbrains-team and GoLand team only so that the logs are not publicly accessible.

    This looks either like a bug in the IDE or a configuration issue on your side but it's hard to tell which without logs. Thank you.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条