goconvey 请 运行 从你的 $GOPATH 中 goconvey 无法导入绝对路径

goconvey Please run goconvey from within your $GOPATH cannot import absolute path

我正在设置 go 并尝试让一个简单的项目与 http://goconvey.co/

一起工作

我将 $GOPATH 设置为 /Users/joe/Desktop/playground/go

当我 运行

$ go get github.com/smartystreets/goconvey

它将所有好的内容下载到我的 GOPATH

所以当我在这里创建一个项目时 /Users/joe/Desktop/playground/go/一些项目

and 运行 goconvey 我得到

2015/02/04 14:41:05 shell.go:93: Please run goconvey from within your $GOPATH

我的测试代码是

package main

import (
    . "github.com/smartystreets/goconvey/convey"
    "testing"
)

func TestStuff(t *testing.T) {
    Convey("Truth", t, func() {
        Convey("is falsey", func() {
            So(false, ShouldBeFalse)
        })
    })

}

我不知道为什么找不到文件。 当我 运行 去测试时,它工作得很好。 有帮助吗?

所有 Go 代码都需要在 $GOPATH/src/ 内,GoConvey UI 才能工作。

因此,如果您的 $GOPATH 设置为

/Users/joe/Desktop/playground/go

那么您需要将您的项目放在

/Users/joe/Desktop/playground/go/src/some-project

您的代码目前位于

/Users/joe/Desktop/playground/go/some-project

说了这么多,错误消息应该修改为如下内容:

Please run goconvey from within $GOPATH/src (also, symlinks might be problematic).

在这种情况下,@VonC 引用的变量名称可能有点用词不当。