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

Fixes #141 #142

Merged
merged 2 commits into from
Aug 22, 2020
Merged

Conversation

rzajac
Copy link
Contributor

@rzajac rzajac commented Aug 4, 2020

Fixes #141

Summary of Changes

  1. Check if struct has IsZero interface during in encoder isZero method and use it.

@elithrar elithrar self-requested a review August 19, 2020 15:41
@elithrar elithrar added the bug label Aug 19, 2020
Copy link
Contributor

@elithrar elithrar left a comment

Choose a reason for hiding this comment

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

The CI builds fail here:


=== RUN   TestRegisterEncoderStructIsZero
--- FAIL: TestRegisterEncoderStructIsZero (0.00s)
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method [recovered]
	panic: reflect.Value.Interface: cannot return value obtained from unexported field or method

@elithrar
Copy link
Contributor

@rzajac Can you PTAL at the CI failure and resolve?

https://app.circleci.com/pipelines/github/gorilla/schema/25/workflows/be95431d-71f1-4fb4-b4bf-035de7905770/jobs/177

This does seem to pass in Go 1.15 (latest) and so I suspect this is backwards incompatible. I have not looked at what reflect changes have occurred since 1.12.

https://app.circleci.com/pipelines/github/gorilla/schema/25/workflows/be95431d-71f1-4fb4-b4bf-035de7905770/jobs/174

@rzajac
Copy link
Contributor Author

rzajac commented Aug 20, 2020

The problem was I was checking for IsZero interface implementation in a wrong way.

@elithrar
Copy link
Contributor

@rzajac - thanks for this!

@elithrar elithrar merged commit 7f62815 into gorilla:master Aug 22, 2020
kirr pushed a commit to joomcode/schema that referenced this pull request Jul 30, 2021
* Fixes gorilla#141

* Fixes gorilla#141 - additional fix for go 1.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] Encoding struct with custom encoder and omitempty panics
2 participants