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

checker/rangeValCopy: stop panicking #1355

Merged
merged 2 commits into from
Jul 27, 2023
Merged

checker/rangeValCopy: stop panicking #1355

merged 2 commits into from
Jul 27, 2023

Conversation

cristaloleg
Copy link
Member

@cristaloleg cristaloleg commented Jul 27, 2023

Fixes #1354

This PR should fix the problem. Fix is somewhat hacky but at least there will be no panics.

In short: having interface as a generic field isn't supported by go/types (assert failure). Instead of copying go/types functions and fixing it it's simpler to recover from a panic and ignore this struct in a checker.

@quasilyte
Copy link
Member

I asked in Gophers slack what would be the best way to handle this.
I don't like that Sizeof is so dangerous now.
If there is no good way to fix it right now, we can use kludge for now.

@quasilyte
Copy link
Member

Let's merge it for now.
I don't know if there is a much better way to do this.
It would be weird to copy the code from go/types.

I'll probably file a Go proposal that would ask a new (safe) Sizeof function.

@cristaloleg cristaloleg merged commit 40e60d7 into master Jul 27, 2023
2 checks passed
@cristaloleg cristaloleg deleted the fix-sizeof-panic branch July 27, 2023 13:24
@korya
Copy link

korya commented Jul 27, 2023

@cristaloleg @quasilyte Thanks, guys!

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.

bug: rangeValCopy still panics on code with generics
3 participants