-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/go/analysis/passes/fieldalignment: runtime error: index out of range #43465
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
Comments
/cc @leitzler for the panic
Can you give a repro example? Analysis only runs on packages with open files, so it's possible that's what you're seeing. |
Yes, a repro would be helpful. This might be fixed already by CL 278372 that is merged to master but not 0.6.x. |
Sorry, I should have done this to start with, I made a repro here https://github.com/napei/alignment-test A file to open for testing this would be This is typical of the codebase I'm working in at the moment, but that has about 40 more files in it. I'll add that this also happens on WSL (linux) as well. |
@stamblerre I have specifically disabled file previews in vscode for that reason. I don't know why they thought that was a good feature 😄 "workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.editor.enablePreview": false, |
Oh interesting. When I embed a struct it panics. Panictype test struct {
field1 bool
field3 float64
field2 int32
}
type Test struct {
test
ID int
Field1 bool
Field2 float64
Field3 int32
} No Panictype test struct {
field1 bool
field3 float64
field2 int32
}
type Test struct {
ID int
Field1 bool
Field2 float64
Field3 int32
} Sorry for the comment spam |
I tried your repro with CL 278372 applied and I'm not able to reproduce it. |
OK, so sounds like this is fixed at master. @napei, ok to close? |
Sure. I'll wait for a release 🙂 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Enabled the following config in vscode inside
settings.json
gopls
log: https://pastebin.com/raw/QmedfAZMLog with trace enabled (not much different): https://pastebin.com/raw/6Zpm0VUw
What did you expect to see?
No errors, and fieldalignment should pick up on the following test struct
What did you see instead?
Field alignment doesn't run when looking at source code inside a sub-folder/another package. When I add the above struct to a file in the root directory of the project, fieldalignment works fine, with hints on the struct.
The text was updated successfully, but these errors were encountered: