安装 go-ethereum 时如何修复“意外目录布局”错误?

dil*_*ess 5 swarm ethereum go-ethereum

所有,我希望这个问题属于这里。

我正在关注 Blockgeeks 教程,试图为以太坊区块链开发设置我的环境。我基本上已经到了最后一步,安装 swarm,但我收到一个错误,似乎与 github 上的文件夹结构有关。我应该如何解决这个问题?

方便的信息:

-OS:Windows 10,在安装了适当 gcc 依赖项的 cygwin 中运行此项目

-Go 版本:1.11.4

几天来我一直试图找到解决方案,但我发现没有任何效果。任何帮助表示赞赏。

基本上,每个人都说这些步骤对他们有用https : //swarm-guide.readthedocs.io/en/latest/installation.html#generic-linux

也许这与cygwin有关?

当我尝试此命令时: $ go install -v ./cmd/swarm

我希望它能够正确安装,但出现此错误:

unexpected directory layout:
        import path: github.com/naoina/toml
        root: C:\cygwin64\home\di203179\go\src
        dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
        expand root: C:\cygwin64\home\di203179\go\src
        expand dir: C:\cygwin64\home\di203179\go\src\github.com\ethereum\go-ethereum\vendor\github.com\naoina\toml
        separator: \
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏。

更新

我想我在这里找到了引发此错误的代码:https : //golang.org/src/cmd/go/internal/load/pkg.go

这是片段:

// dirAndRoot returns the source directory and workspace root
// for the package p, guaranteeing that root is a path prefix of dir.
func dirAndRoot(p *Package) (dir, root string) {
    dir = filepath.Clean(p.Dir)
    root = filepath.Join(p.Root, "src")
    if !str.HasFilePathPrefix(dir, root) || p.ImportPath != "command-line-arguments" && filepath.Join(root, p.ImportPath) != dir {
        // Look for symlinks before reporting error.
        dir = expandPath(dir)
        root = expandPath(root)
    }

    if !str.HasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator || p.ImportPath != "command-line-arguments" && !p.Internal.Local && filepath.Join(root, p.ImportPath) != dir {
        base.Fatalf("unexpected directory layout:\n"+
            "   import path: %s\n"+
            "   root: %s\n"+
            "   dir: %s\n"+
            "   expand root: %s\n"+
            "   expand dir: %s\n"+
            "   separator: %s",
            p.ImportPath,
            filepath.Join(p.Root, "src"),
            filepath.Clean(p.Dir),
            root,
            dir,
            string(filepath.Separator))
    }

    return dir, root
}
Run Code Online (Sandbox Code Playgroud)

似乎有几个与路径相关的问题可能会使 Go 项目抛出此错误。但我觉得我的路是对的,所以我还是不知所措……

更新 2:

我已经确认该片段中的第一个 if 语句正在运行,并且第二个 if 语句的前三个条件解析为 false(意味着它们不是错误的原因),因此这意味着最后一个条件由由于错误正在抛出,因此多个 AND 语句必须返回 true。尽管如此,仍然无法说出原因。谢谢你的帮助。