Open mundaym opened 8 years ago
I don't know why there are so widespread use of an internal cgo feature that is only intended for bootstrapping Go on a new platform.
What do you use cgo -godefs for?
My use case is the syscall
package in std and maybe x/sys/unix
. Both for the s390x port. We need to add some new struct types to types_linux.go and I haven't thought of a clean way to do it without either adding to the APIs on other platforms or adding a new autogenerated (z*.go) file. It probably isn't worth adding this feature just for this use case, but I thought I'd create an issue in case there was any other interest.
It would be nice if the output of the command
cgo -godefs
with multiple input files resulted in a legal source file. Currently it duplicates the package declaration (and the generated comments) rendering the output useless without post-processing (since all the output goes straight to stdout):It would be nice if the output were instead:
This would be useful in situations where
cgo -godefs
requires extra/different information on different platforms. It is generally fairly easy to workaround though and the lack of this feature in previous versions of go might limit its usefulness.