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/cmd/gotype: Now considers C.int an invalid type #22090
Comments
CC @griesemer |
Before I dive into this, could you please check and let me know if there's a difference when you run gotype with the -c=gc option? (This was the default in the past, now it's -c=source.) Thanks. |
@griesemer I have the same problems with go1.9.1
|
See the same issue with github.com/mattn/go-sqlite3 on
|
go build is ok, get error under go generate :
|
for this code: type Login C.odbUSHORT
const (
Normal Login = C.ODB_LOGIN_NORMAL
Reserved = C.ODB_LOGIN_RESERVED
Single = C.ODB_LOGIN_SINGLE
) These constants compile fine. gotype is used by stringer. stringer fails to parse constants because of gotype. |
Simple reproducer for the issues with github.com/mattn/go-sqlite3:
gotype reports:
At least the first error is trivial to fix (CL forthcoming). |
Change https://golang.org/cl/88375 mentions this issue: |
Changed milestone to Go1.10 per discussion with @ianlancetaylor . |
It appears that in go1.9, gotypes now handles C.int differently than it did in previous versions, now producing an invalid type error.
What version of Go are you using (
go version
)?go version go1.9 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?arch linux amd64
What did you do?
❯go get github.com/mattn/go-sqlite3
❯ gotype ~/go/src/github.com/mattn/go-sqlite3/
What did you expect to see?
No type errors, as was the case with go1.8.3
What did you see instead?
/home/jmunson/go/src/github.com/mattn/go-sqlite3/error.go:14:17: invalid constant type invalid type
The text was updated successfully, but these errors were encountered: