Golang即使在正确的目录设置下也出现了意外的目录布局。

huangapple go评论91阅读模式
英文:

golang unexpected directory layout even with right directory setup

问题

我设置了Go包,并且遇到了unexpected directory layout:错误。

完整错误信息:

unexpected directory layout:
        import path: _/home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        root: /home/ravkod/go/src
        dir: /home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        expand root: /home/ravkod/go
        expand dir: /home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        separator: /

我的GOPATH是GOPATH="/home/ravkod/go"

复现步骤:

  1. cd /home/ravkod/go/src/github.com
  2. git clone git://g.csail.mit.edu/6.824-golabs-2020 6.824
  3. cd /home/ravkod/go/src/github.com/ravkod/6.824/src/main
  4. sh test-mr.sh

这些指令是从http://nil.csail.mit.edu/6.824/2020/labs/lab-mr.html复制过来的。

英文:

I set up go package and I am getting unexpected directory layout: error

Full error :

unexpected directory layout:
        import path: _/home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        root: /home/ravkod/go/src
        dir: /home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        expand root: /home/ravkod/go
        expand dir: /home/ravkod/go/src/github.com/ravkod/6.824/src/mr
        separator: /

My GOPATH is GOPATH="/home/ravkod/go"

Reproduce Steps:

  1. cd /home/ravkod/go/src/github.com
  2. git clone git://g.csail.mit.edu/6.824-golabs-2020 6.824
  3. cd /home/ravkod/go/src/github.com/ravkod/6.824/src/main
  4. sh test-mr.sh

These instructions are copied from http://nil.csail.mit.edu/6.824/2020/labs/lab-mr.html

答案1

得分: 2

奇怪的GOPATH情况应该在2021年的课程中得到修复:https://pdos.csail.mit.edu/6.824/labs/lab-mr.html(材料/实验室内容没有实质性改变,所以你应该可以按照这个版本进行操作而没有问题)。

如果你确实想让旧版本工作,你需要将GOPATH设置为指向6.824目录,即对于你的情况,GOPATH=/home/ravkod/go/src/github.com/ravkod/6.824。2020年(以及之前的年份)的课程仓库依赖于这种非标准的GOPATH用法。

英文:

The weird GOPATH situation should be fixed in the 2021 offering of the class: https://pdos.csail.mit.edu/6.824/labs/lab-mr.html (and the material/labs are not substantially changed, so you should be able to follow this version instead with no issue).

If you do want to get the old version working, you'd need to set GOPATH to point to the 6.824 directory, i.e. GOPATH=/home/ravkod/go/src/github.com/ravkod/6.824 for your case. The class repo from 2020 (and earlier years) relies on this non-standard usage of GOPATH.

huangapple
  • 本文由 发表于 2021年6月26日 10:16:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/68138664.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定