英文:
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"
复现步骤:
- cd /home/ravkod/go/src/github.com
- git clone git://g.csail.mit.edu/6.824-golabs-2020 6.824
- cd /home/ravkod/go/src/github.com/ravkod/6.824/src/main
- 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:
- cd /home/ravkod/go/src/github.com
- git clone git://g.csail.mit.edu/6.824-golabs-2020 6.824
- cd /home/ravkod/go/src/github.com/ravkod/6.824/src/main
- 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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论