You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
$ cat a.go
package ex
/*
typedef int a;
*/
import "C"
type Atype C.a
$ cat b.go
package ex
/*
typedef int b;
*/
import "C"
type Btype C.b
$ go tool cgo -godefs a.go b.go
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs a.go b.go
package ex
type Atype int32
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs a.go b.go
package ex
type Btype int32
It would be nice if the output were instead:
$ go tool cgo -godefs a.go b.go
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs a.go b.go
package ex
type Atype int32
type Btype int32
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: