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
fakexml: doesn't terminate checking type X *X
#1202
Labels
Comments
fho
changed the title
staticcheck hangs forever on recursive type definition
staticcheck hangs forever on recursive type definition with buildtag
Mar 16, 2022
fho
changed the title
staticcheck hangs forever on recursive type definition with buildtag
staticcheck hangs forever on recursive type definition with struct tag
Mar 16, 2022
Can reproduce. |
In v0.2.2 we started reusing encoding/xml's logic for checking if types can be marshaled. We inherited its infinite loop (cf. https://go.dev/play/p/SYxLx7YKqoT which doesn't terminate). This is (probably) fine for encoding/xml, which in general doesn't support cyclic data structures, but obviously not fine for static analysis. |
dominikh
changed the title
staticcheck hangs forever on recursive type definition with struct tag
fakexml: doesn't terminate checking Mar 16, 2022
type X *X
thanks a lot @dominikh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code causes staticcheck v0.2.2 (
staticcheck ./...
) to hang forever.staticcheck v0.2.1 terminates quickly on the same code.
If the struct tag
xml:"operationCode"
inOperationHeaders
is omitted, staticcheck 0.2.2 also terminates.A type definition like this was generated by an xml code generator.
I don't know when such a type definition could make sense.
Go 1.17 and 1.18 compile the code without any issues.
The text was updated successfully, but these errors were encountered: