Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running godog build or godog run returns an error about not being able to import godog. #473

Closed
countingtoten opened this issue Apr 28, 2022 · 2 comments

Comments

@countingtoten
Copy link

👓 What did you see?

Running godog build or godog run returns an error about not being able to import godog.

Error: could not build binary at: "godog.test". reason: failed to compile tested package: /Users/jweinert/src/bdd-example, reason: exit status 1, output: WORK=/var/folders/97/77r4rn4x51s5_q1h8k16x6900000gn/T/go-build497481945
# example.com/bdd-example
godog_dependency_file_test.go:3:8: cannot find package "." in:
	/Users/jweinert/src/bdd-example/vendor/github.com/cucumber/godog
FAIL	example.com/bdd-example [setup failed]

Usage:
  godog build [flags]

Examples:
  godog build
  godog build -o godog.test

Flags:
  -h, --help            help for build
  -o, --output string   compiles the test runner to the named file
                         (default "godog.test")

could not build binary at: "godog.test". reason: failed to compile tested package: /Users/jweinert/src/bdd-example, reason: exit status 1, output: WORK=/var/folders/97/77r4rn4x51s5_q1h8k16x6900000gn/T/go-build497481945
# example.com/bdd-example
godog_dependency_file_test.go:3:8: cannot find package "." in:
	/Users/jweinert/src/bdd-example/vendor/github.com/cucumber/godog
FAIL	example.com/bdd-example [setup failed]

✅ What did you expect to see?

I expected to see the output from the README.md.

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:6
    Given there are 12 godogs
    When I eat 5
    Then there should be 7 remaining

1 scenarios (1 undefined)
3 steps (3 undefined)
220.129µs

You can implement step definitions for undefined steps with these snippets:

func iEat(arg1 int) error {
        return godog.ErrPending
}

func thereAreGodogs(arg1 int) error {
        return godog.ErrPending
}

func thereShouldBeRemaining(arg1 int) error {
        return godog.ErrPending
}

func InitializeScenario(ctx *godog.ScenarioContext) {
        ctx.Step(`^I eat (\d+)$`, iEat)
        ctx.Step(`^there are (\d+) godogs$`, thereAreGodogs)
        ctx.Step(`^there should be (\d+) remaining$`, thereShouldBeRemaining)
}

📦 Which tool/library version are you using?

go install github.com/cucumber/godog/cmd/godog@v0.12.0

🔬 How could we reproduce it?

OS: macOS 12.3.1
Go: 1.18.1

Steps to reproduce the behavior:

  1. Install the latest godog
go install github.com/cucumber/godog/cmd/godog@v0.12.0
  1. Create a new go module
go mod init example.com/test
  1. Attempt to build in the directory.
godog build
  1. Observe error
@vearutop
Copy link
Member

Please use latest godog that can be installed with

go install github.com/cucumber/godog/cmd/godog@latest

We need to update README to make it more accurate and helpful.

@vearutop
Copy link
Member

I'm closing the issue, but feel free to reopen it if the problem persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants