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/vet, cgo: spurious report on C.CBytes call #17563

Closed
alandonovan opened this issue Oct 24, 2016 · 1 comment

Comments

Projects
None yet
4 participants
@alandonovan
Copy link
Contributor

commented Oct 24, 2016

$ nl -ba a.go
     1  package main
     2
     3  import "C"
     4
     5  func _(b []byte) {
     6          _ = C.CBytes(b)
     7  }
$ vet a.go
a.go:6: possibly passing Go type with embedded pointer to C

Vet reports an error each time the C.CBytes function is called, because its argument is a byte slice, which contains a pointer. However, this function is being used exactly as intended and Vet should make an special exception for it.

@gopherbot

This comment has been minimized.

Copy link

commented Oct 24, 2016

CL https://golang.org/cl/31810 mentions this issue.

@quentinmit quentinmit added the NeedsFix label Oct 24, 2016

@quentinmit quentinmit added this to the Go1.8 milestone Oct 24, 2016

@quentinmit quentinmit changed the title vet: cgo: spurious report on C.CBytes call cmd/vet, cgo: spurious report on C.CBytes call Oct 24, 2016

gopherbot pushed a commit that referenced this issue Oct 24, 2016

cmd/vet: cgo: emit no error for calls to C.CBytes
Fixes issue #17563

Change-Id: Ibb41ea9419907193526cc601f6afd07d8689b1fe
Reviewed-on: https://go-review.googlesource.com/31810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

@rsc rsc closed this Oct 25, 2016

@golang golang locked and limited conversation to collaborators Oct 25, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.