drgd73844 2015-02-04 03:50
浏览 315
已采纳

请在$ GOPATH中运行goconvey无法导入绝对路径

I'm setting up go and trying to get a simple project working with http://goconvey.co/

I have my $GOPATH set to /Users/joe/Desktop/playground/go

and when I run

$ go get github.com/smartystreets/goconvey

it downloads all good to my GOPATH

so when I create a project here /Users/joe/Desktop/playground/go/some-project

and run goconvey I get

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

My testing code is

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)
        })
    })

}

I don't know why it connot find the files. When I run go test it works perfectly. Help?

  • 写回答

1条回答 默认 最新

  • dougan4884 2015-02-04 19:40
    关注

    All go code needs to be within $GOPATH/src/ for the GoConvey UI to work.

    So, if your $GOPATH is set to

    /Users/joe/Desktop/playground/go
    

    then you will need to put your project at

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

    Your code is currently at

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

    Having said all that, the error message should probably be modified to read something like this:

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

    The name of the variable referenced by @VonC is probably a slight misnomer in this case.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 麒麟V10桌面版SP1如何配置bonding
  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中
  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信