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.

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

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用