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

unconvert warns about cgo helper file #39

Closed
mdempsky opened this issue Jan 11, 2019 · 0 comments
Closed

unconvert warns about cgo helper file #39

mdempsky opened this issue Jan 11, 2019 · 0 comments

Comments

@mdempsky
Copy link
Owner

Run unconvert on a file like

package p

// unsigned int myfunc() {}
import "C"

func f() interface{} {
	return C.myfunc
}

and you get a warning like

/home/mdempsky/.cache/go-build/d8/d81f94c4432b3a1654386c81604bbadaa821007a82fab40c6528acc37bbb19e6-d:38:56: unnecessary conversion

This is because cgo generates a line like:

var _Cfpvar_fp_myfunc unsafe.Pointer = (unsafe.Pointer)(unsafe.Pointer(&__cgo_myfunc))

I should either not warn about the file (it does have a "// Code generated by cmd/cgo; DO NOT EDIT." comment; see also #17), or maybe fix cmd/cgo to not emit the unnecessary conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant