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

Incorrect project structure gives an unhelpful error message #383

Closed
Ekberg opened this issue Mar 16, 2021 · 3 comments · Fixed by #468
Closed

Incorrect project structure gives an unhelpful error message #383

Ekberg opened this issue Mar 16, 2021 · 3 comments · Fixed by #468
Assignees
Labels
good first issue Good for newcomers

Comments

@Ekberg
Copy link
Contributor

Ekberg commented Mar 16, 2021

Please answer these questions before submitting a bug report.

What version of godog are you using?

0.11.0

What version of Go are you using?

1.16.2

What did you do?

Created a new project with the following structure,

|-- features
|   `-- health.feature
|-- main.go
|-- Dockerfile
|-- go.mod
`-- go.sum

My main.go,

package main

import "github.com/cucumber/godog"

func InitializeScenario(ctx *godog.ScenarioContext) {

}

I wanted to confirm that my Dockerfile was correctly working and running this minimal example with godog. But it failed, I then tried running it with my local copy of godog, but that failed as well.

After doing the following change it worked,

$ mv main.go main_test.go

What did you expect to see?

A more informative error message on why godog failed with my minimal example.

What did you see instead?

$ godog
failed to compile testmain package: exit status 1 - output: compile: -importcfg: open /tmp/go-build1250231118/b001/importcfg.link: no such file or directory
@davidvartanian
Copy link

This just happened to me as well. I think checking for the right project structure and giving a better error message will save many people plenty of time.

@mattwynne mattwynne added the good first issue Good for newcomers label Nov 10, 2021
ALCooper12 added a commit to ALCooper12/godog that referenced this issue Nov 10, 2021
@mattwynne
Copy link
Member

mattwynne commented Nov 11, 2021

Yesterday @ALCooper12 and I paired on this problem. We've made a bit of a start on it by adding an example in the _examples folder in her fork, where we can reproduce the problem.

I'm new to Go so this is fun!

We're meeting up again next week, when we'll see if we can work out where we'd introduce a change into the code to give a better error message. If anyone has any pointers, we'd love to hear them. I've never worked in this codebase before.

@mattwynne
Copy link
Member

I think I've got a failing test here: e5b2693

ALCooper12 added a commit to ALCooper12/godog that referenced this issue Mar 30, 2022
mattwynne added a commit that referenced this issue Apr 6, 2022
vearutop added a commit that referenced this issue Apr 28, 2022
* Add example about incorrect project structure

This is to help reproduce #383

* Added some debugging statements

* Update go.sum for example project

* Made a cmd_run_test.go file in order to test and run the builderAndRunGodog function in order to see it fail

* added new assertion test

* Matt and I added debugging

Co-authored-by: Matt Wynne <[email protected]>

* Matt and I tried to logging through the cobra command

by using cmd.OutOrStdout( )

* Improved some debugging

* Add a failing test for Builder that reproduces #383

* added new test for IncorrectProjectStructure #383

* Revert "Add a failing test for Builder that reproduces #383"

This reverts commit e5b2693.

* ignored vscode files

Co-authored-by: Matt Wynne <[email protected]>

* undid debugging changes

* undid debugging changes

* removed redundant test

* added check for incorrect project structure

we examined the output from running `go test` which tells us if we didn't
find any test files.
we tweaked the error message to follow the capitalization rules

Co-authored-by: Matt Wynne <[email protected]>

* Update internal/builder/builder_test.go

Co-authored-by: Matt Wynne <[email protected]>
Co-authored-by: Matt Wynne <[email protected]>
Co-authored-by: Viacheslav Poturaev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants