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

cmd/cgo: some type checks tightened since Go 1.12 #31601

Closed
eliasnaur opened this issue Apr 21, 2019 · 2 comments
Closed

cmd/cgo: some type checks tightened since Go 1.12 #31601

eliasnaur opened this issue Apr 21, 2019 · 2 comments

Comments

@eliasnaur
Copy link
Contributor

eliasnaur commented Apr 21, 2019

What version of Go are you using (go version)?

$ go version
go version devel +dc193dee15 Fri Apr 19 19:47:53 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Only with tip.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/elias/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/elias/go"
GOPROXY=""
GORACE=""
GOROOT="/home/elias/dev/go-tip"
GOTMPDIR=""
GOTOOLDIR="/home/elias/dev/go-tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build014756832=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ git clone https://git.sr.ht/~sircmpwn/go-libvterm
...
$ cd go-libvterm
$ git checkout 75984434 
...
$ go1.12.2 build
$ go build
# git.sr.ht/~sircmpwn/go-libvterm
./vterm.go:215:8: cannot use _Ctype_uchar(r) (type _Ctype_uchar) as type uint8 in assignment
./vterm.go:216:10: cannot use _Ctype_uchar(g) (type _Ctype_uchar) as type uint8 in assignment
./vterm.go:217:9: cannot use _Ctype_uchar(b) (type _Ctype_uchar) as type uint8 in assignment

What did you expect to see?

No errors from the go tip build.

What did you see instead?

An error caused by stricter C type checks.

Note that the cgo error is technically correct: the correct type of the VTermColor fields is indeed uint8_t, not uchar. I'm filing this to make sure the tighter checks are deliberate.

@ianlancetaylor
Copy link
Contributor

Same as #31093?

@eliasnaur
Copy link
Contributor Author

Seems so.

ddevault pushed a commit to ddevault/go-libvterm that referenced this issue May 26, 2019
See also golang/go#31601.

Gofmt vterm.go while here.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
@golang golang locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants