我在golang项目中运行测试时得到以下输出(截断。请参阅下面的完整输出):
import path contains backslash; use slash: "gitlab.com\\group-name\\project-name/vendor/..."
project-name
是我正在处理的项目的名称。项目本身运行顺利,只有测试是错误的。
我不知道如何生成这样的导入路径(包含\\
),谁负责生成该导入(是go test
?),我该如何解决?
我试图在将版本从1.6.x升级到1.8之后运行测试,如果这件事。
环境:
命令:
go test api_test.go
输出
# command-line-arguments
.\api_test.go:6: import path contains backslash; use slash: "gitlab.com\\group-name\\project-name/vendor/github.com/smartystreets/assertions"
.\api_test.go:6: cannot import "gitlab.com\\group-name\\project-name/vendor/github.com/smartystreets/goconvey/convey"
due to version skew - reinstall package (bad package path "gitlab.com\\group-name\\project-name/vendor/github.com/smartystreets/assertions" for package assertions)
FAIL command-line-arguments [build failed]
api_test.go:(现在只是goconvey的随机样本,仍然会产生错误)
package test
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestIntegerStuff(t *testing.T) {
Convey("Given some integer with a starting value", t, func() {
x := 1
Convey("When the integer is incremented", func() {
x++
Convey("The value should be greater by one", func() {
So(x, ShouldEqual, 2)
})
})
})
}