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

return nil schema on error #540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nasermirzaei89
Copy link

Golang methods shouldn't return zero value structs on error. So, we should return *Schema on the NewSchema method.

Why:
https://groups.google.com/d/msg/golang-nuts/4yBldwsjZwo/sFcz1KVhU3wJ

@coveralls
Copy link

coveralls commented Apr 25, 2020

Coverage Status

Coverage remained the same at 92.376% when pulling 51495a7 on nasermirzaei89:pointer-return into 02caa89 on graphql-go:master.

@bhoriuchi
Copy link
Contributor

bhoriuchi commented May 18, 2020

This will break a lot of people's code. So while I agree that it should be done, it should probably be done so in a major release. Additionally you should be checking the error returned before you attempt to access the schema. If the "programmer is to lazy to check the error" then they are probably too lazy to check that the schema returned nil, so they will still get an exception regardless.

@nasermirzaei89
Copy link
Author

I agree with merge it for a major release.

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.

None yet

3 participants