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

Give a better error if package_bindings is a file #221

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

benjaminjkraft
Copy link
Collaborator

The entries under the new package_bindings field should be packages,
but it's an easy mistake to put a file path instead (most of the other
fields in genqlient.yaml are files). Due to some bizzare behavior from
go/packages (described in #220), if you do that you get weird broken
code that gives you no clue what is wrong. Instead, let's guess if what
you gave us looks like a filename, and report a nice error if so.

Test plan: crossed fingers

I have:

  • Written a clear PR title and description (above)
  • Signed the Khan Academy CLA
  • Added tests covering my changes, if applicable
  • Included a link to the issue fixed, if applicable
  • Included documentation, for new features
  • Added an entry to the changelog

The entries under the new `package_bindings` field should be packages,
but it's an easy mistake to put a file path instead (most of the other
fields in `genqlient.yaml` are files). Due to some bizzare behavior from
`go/packages` (described in #220), if you do that you get weird broken
code that gives you no clue what is wrong. Instead, let's guess if what
you gave us looks like a filename, and report a nice error if so.

Test plan: crossed fingers
Copy link
Member

@csilvers csilvers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Don't go naming your directories 'something.go/' though!

@benjaminjkraft
Copy link
Collaborator Author

I think in theory it's legal! As long as your package clause is still package something. But it seems unlikely anyone actually does that.

@benjaminjkraft benjaminjkraft merged commit 16a17f2 into main Aug 15, 2022
@benjaminjkraft benjaminjkraft deleted the benkraft.package-binding-error branch August 15, 2022 22:08
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

Successfully merging this pull request may close these issues.

2 participants