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

Issues generating fakes on demand when using go 1.13.1 #147

Closed
jfmyers9 opened this issue Oct 11, 2019 · 0 comments
Closed

Issues generating fakes on demand when using go 1.13.1 #147

jfmyers9 opened this issue Oct 11, 2019 · 0 comments

Comments

@jfmyers9
Copy link

As a design decision, we have decided to not check in our counterfeiter fakes and choose to generate them on demand in CI when necessary.

As of go 1.13.1, counterfeiter is no longer able to generate fakes when the following is true:

  • the <package>fakes directory does not exist
  • there is a file that imports the <pacakge>fakes directory

It will fail with the following output:

± |master ✓ | → go generate ./...
Writing `FakeThingDoer` to `counterfeiterreprofakes/fake_thing_doer.go`...
-: go: finding github.com/jfmyers9/counterfeiterrepro/counterfeiterreprofakes latest
go build github.com/jfmyers9/counterfeiterrepro/counterfeiterreprofakes: no Go files in
exit status 1
stuff.go:3: running "go": exit status 1

As an example, we built the following repository: https://github.com/jfmyers9/counterfeiterrepro

In our exploration, we oddly found that if you added packages.NeedTypesInfo to

Mode: packages.NeedName | packages.NeedFiles | packages.NeedImports | packages.NeedDeps | packages.NeedTypes,
it will fix the issue. But we weren't confident in the reasoning behind this change and wanted to discuss it further.

Let us know if you have any other questions,

@jfmyers9 && @christarazi

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

1 participant