rillig / gobco

Measure branch coverage of golang tests
62 stars 12 forks source link

Upgrading from old version #14

Closed KantarBruceAdams closed 4 years ago

KantarBruceAdams commented 4 years ago

I have been using an old version with some success:

github.com/rillig/gobco v0.0.0-20190630104235-ff234e5b7147

Passing arguments through to go test as follows:

gobco -args -short -tags gobco

I now looking to migrate to a more recent version. I find that gobco no longer accepts these options. Presumably it should now be something like:

gobco -test -short -test -tags -test gobco

However, I cannot get far enough to try this. I am using go 1.11 as that is the latest version backported to Debian 9 (Stretch).

If I run gobco by itself from my source directory I get the somewhat cryptic:

argument "." must be inside "/home/brucea/go/src"

I do not use GOPATH. It is unset in my environment. However go env shows it as

GOPATH="/home/brucea/go"

Which I think is not a coincidence. Sure enough if I run:

GOPATH=`pwd` gobco

I get instead:

argument "." must be inside "<pwd>/src"

My code is not in a directory called src however. If I rename the path to src just to explore this issue I can then run:

 GOPATH=`pwd`/.. gobco

It gets further but then fails to find packages I depend on as these are not in sub-directories of src (i.e. relative to GOPATH) either: E.g.

foobar.go:4:2: cannot find package "github.com/cenkalti/backoff" in any of:
/usr/lib/go-1.11/src/github.com/cenkalti/backoff (from $GOROOT)
/tmp/gobco-1f233fb4-c10d-4a4d-b8d3-1f5ea2fd571d/src/github.com/cenkalti/backoff
    /pwd/one/dir/up/src/github.com/cenkalti/backoff

Do you have any suggestions as to how to resolve this?

rillig commented 4 years ago

Please describe the environment and the filesystem layout that you are using. The wiki page for GOPATH mentions the setup that gobco supports. As far as I can see, you are using a non-standard setup.

rillig commented 4 years ago

Feedback timeout.

KantarBruceAdams commented 4 years ago

Sorry I wasn't able to look into this further. I think I resolved my own issue. I think it was related to modules being picked up for a 'tools.go' to fix tool versions like godbc and modules for the main program becoming confused with each other.