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

fieldIndexByName: extract type from interface in fieldIndexByName #370

Merged

Conversation

ale-rinaldi
Copy link
Contributor

@ale-rinaldi ale-rinaldi commented Feb 3, 2020

Fix #369

This fixes the issue with no apparent regressions, but since I don't know why this check was in place, I'm not sure that's the right solution.

Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Can you provide a test case which exercises this issue please.

@ale-rinaldi
Copy link
Contributor Author

Sure, I added it in bug_test.go as Test_issue369.

Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

This seems to cause a regression, when I test here I got:

~~~ FAIL: (Terst)
        type_go_struct_test.go:31:
                FAIL (==)
                     got: ,,,b1 (*otto._object=ptr)
                expected: a1,a2,a3,b1
--- FAIL: TestGoStructEmbeddedFields (0.00s)
FAIL
FAIL    github.com/robertkrimen/otto    1.271s

@stevenh stevenh added the bug label Sep 27, 2021
@ale-rinaldi ale-rinaldi force-pushed the fix/369-json-stringify-panic-anonymous branch from 440d6db to 6b89d43 Compare September 27, 2021 16:05
@ale-rinaldi ale-rinaldi changed the title fieldIndexByName: Remove f.Anonymous check fieldIndexByName: extract type from interface in fieldIndexByName Sep 27, 2021
@ale-rinaldi
Copy link
Contributor Author

Yeah, sorry, my fault. Some time passed since I did this and I was on my first Golang works. Earlier today I was not aligned to master so I wasn't running tests correctly for some reason.

I looked at this again and my approach of totally removing the check was nonsense. I think this is OK now.

Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Sorry to be a pain, could you rebase to master so that we get github action tests firing please.

@ale-rinaldi ale-rinaldi force-pushed the fix/369-json-stringify-panic-anonymous branch from 69437f3 to 953fe8e Compare September 28, 2021 08:24
@ale-rinaldi
Copy link
Contributor Author

Hello, of course, I just did it 👍

@stevenh stevenh merged commit 37f2928 into robertkrimen:master Nov 25, 2022
sg3des pushed a commit to sg3des/otto that referenced this pull request Jul 17, 2023
Fix panic when handling a pointer to a struct.

Fixes robertkrimen#369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic in JSON.stringify of struct with anonymous pointer field
2 participants