doufu6504 2016-10-07 13:43
浏览 107
已采纳

前往:无法在symlink中打包

I have one go project. In this project, for example I have a lib_project that is a symlink to another directory, for example: github_project

After I pull source code to local, I update another git submodules (github_project is one submodule). And then I go here and compile project.

After that, I go to my main project and try to run command go. I meet exception:

package github.com/main_project/test.go: cannot find package "github.com/main_project/lib_project/some_random_file.go" in any of:

        /usr/local/Cellar/go/1.7.1/libexec/src/github.com/main_project/lib_project/some_random_file.go (from $GOROOT)

        /Users/my_user/Documents/go/src/github.com/main_project/lib_project/some_random_file.go (from $GOPATH)

I have tested and see that the directory github.com/main_project/lib_project/some_random_file.go is exsit. I can cd to this and open file. That looks like Go doesn't recognize symlink folder (in this case is lib_project)

  • 写回答

1条回答 默认 最新

  • dongtun1209 2016-10-07 13:49
    关注

    The Go tools purposely don't follow symlinks. Make sure there aren't any in your GOPATH, and always use the full import path relative to $GOPATH/src/ for installed packages, and relative to the vendor/ directory for vendored packages.

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

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探