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

请在$ 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 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题