安装go-ethereum时如何解决“意外的目录布局”错误?

时间:2018-12-26 21:22:56

标签: ethereum go-ethereum swarm

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

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

便捷信息:

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

-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: \

感谢您的帮助。

更新

我想我在这里找到了引发此错误的代码: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
}

似乎有一些与路径相关的问题可能会使Go项目抛出此错误。但是我觉得我的道路是正确的,所以我仍然茫然不知所措...

更新2:

我已经确认该代码段的第一个if语句正在运行,第二个if语句的前三个条件解析为false(这意味着它们不是错误的原因),因此这意味着最后一个条件是由多个AND语句组成,因为抛出了错误,所以必须返回true。不过,仍然无法说出原因。感谢您的帮助。

0 个答案:

没有答案