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 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测