gogoconvey

goconvey Please run goconvey from within your $GOPATH cannot import absolute path


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?


Solution

  • 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.