mdempsky / unconvert

Remove unnecessary type conversions from Go source
BSD 3-Clause "New" or "Revised" License
377 stars 26 forks source link

C: no such file or directory #23

Closed xlab closed 5 years ago

xlab commented 7 years ago
$ unconvert -v github.com/vulkan-go/vulkan
2017/07/07 16:17:49 open /Users/xlab/Documents/dev/go/src/github.com/vulkan-go/vulkan/C: no such file or directory
go version go1.9beta2 darwin/amd64
dmitshur commented 7 years ago

Does anything change if you do go install -v github.com/vulkan-go/vulkan, and then unconvert -v github.com/vulkan-go/vulkan?

xlab commented 7 years ago

@shurcooL I tried, it doesn't help.

$ go install -v github.com/vulkan-go/vulkan
github.com/vulkan-go/vulkan
$ unconvert -v github.com/vulkan-go/vulkan
2017/07/07 18:07:56 open /Users/xlab/Documents/dev/go/src/github.com/vulkan-go/vulkan/C: no such file or directory
cznic commented 7 years ago

It looks like some loader mistakenly attempts to import "C".

xlab commented 7 years ago

@cznic @shurcooL I actually tried to create a minimal reproducible example, but it works fine in handmade cases..

mdempsky commented 6 years ago

Minimal repro case:

package p

// unsigned int myfunc();
import "C"

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

The "C" file is actually the _cgo_gotypes.go file generated by cgo. The "C" name is synthesized by go/loader.

mdempsky commented 5 years ago

Looks like this is working now to me: unconvert -v github.com/vulkan-go/vulkan prints a bunch of unnecessary conversions.