cucumber / godog

Cucumber for golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

failed to compile testmain package when running example

MrRickSan opened this issue · comments

Please answer these questions before submitting a bug report.

What version of godog are you using?

> godog -version
Godog version is: v0.10.0

What version of Go are you using?

> go version
go version go1.15.2 darwin/amd64

What did you do?

I was trying to run the example in github.com/cucumber/godog/_examples/godogs like this:

> godog

What did you expect to see?

The test results, the tests ran successfully.

What did you see instead?

The following output error:

failed to compile testmain package: exit status 2 - output: /var/folders/7p/457816xx2fz6gywn78r25g_m0000gn/T/go-build708885531/b001/_testmain.go:5:2: can't find import: "github.com/cucumber/godog/_examples/godogs"

Additional context

When I run using go test it works:

> go test

Feature: eat godogs
  In order to be happy
  As a hungry gopher
  I need to be able to eat godogs

  Scenario: Eat 5 out of 12          # features/godogs.feature:7
    Given there are 12 godogs        # godogs_test.go:37 -> godogs.thereAreGodogs
    When I eat 5                     # godogs_test.go:41 -> godogs.iEat
    Then there should be 7 remaining # godogs_test.go:49 -> godogs.thereShouldBeRemaining

1 scenarios (1 passed)
3 steps (3 passed)
313.75µs
testing: warning: no tests to run
PASS
ok  	godogs	0.234s

Just got it working when using:
❯ GO111MODULE=off godog

Hey @MrRickSan, thanks for reporting!

Are you running the godogs example from within the $GOPATH?
I'm thinking that maybe we should look at the documentation around this.

BR Fredrik

Yes, it was withing the $GOPATH

Thanks, makes sense, I will reopen the issue and make sure we add this to the documentation.

@MrRickSan, if you want to have a look: #352 :)

Thank you @lonnblad, welcome improvement!

Guys when I run godog after install the godog packages, I get response of
Command 'godog' not found, did you mean:

command 'godoc' from deb golang-golang-x-tools

Try: sudo apt install

I am using Ubuntu 18.04