2

在我的 golang 项目中运行测试时,我得到了以下输出(截断。请参阅下面的完整输出):

import path contains backslash; use slash: "gitlab.com\\group-name\\project-name/vendor/..."

project-name是我正在处理的项目的名称。项目本身运行顺利,只有测试出错。

我不知道这样的导入路径(包含\\)是如何生成的,谁可以负责生成该导入(是go test吗?),我应该如何修复它?

如果这个问题,我尝试在将 go 版本从 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)
            })
        })
    })
}
4

0 回答 0