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
x/tools/cmd/gotype: fails on arrays with Cgo-defined lengths #23712
Comments
One fix: change typexpr.go:378 (arrayLength) to return -1 for non-constant arrays-- this seems to be the correct option to indicate an "error/invalid-length" array and prevent cascading errors. I can make a CL for that (with tests) if that's the correct route. Related: #22090 |
CC @griesemer |
@rmmh Setting the array length to -1 works here but it's a somewhat unintended consequence of how go/types handles |
Change https://golang.org/cl/93438 mentions this issue: |
Ts is go/types forked from go@236abdb46b (just after 1.10) and cherry-picked go@1006f703ffc, which fixes golang/go#23712. It can be removed when all builders are >= go1.11.
Ts is go/types forked from go@236abdb46b (just after 1.10) and cherry-picked go@1006f703ffc, which fixes golang/go#23712. It can be removed when all builders are >= go1.11.
What version of Go are you using (
go version
)?1.10rc1
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?Ubuntu 16.04.
What did you do?
Use gotype (or go/types) to typecheck code that includes C declarations. Reduced test case:
What did you expect to see?
No errors.
What did you see instead?
The text was updated successfully, but these errors were encountered: