Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.14 linux/amd64
Does this issue reproduce with the latest release?
Yes, it also reproduces with tip. However, it doesn't reproduce with go1.13.8
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/tklauser/.cache/go-build" GOENV="/home/tklauser/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/tklauser/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/tklauser/src/go/src/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build562307077=/tmp/go-build -gno-record-gcc-switches"
What did you do?
$ cat repro.go package unix /* #include <time.h> #include <linux/errqueue.h> */ import "C" type Timespec C.struct_timespec type ScmTimestamping C.struct_scm_timestamping $ go1.14 tool cgo -godefs repro.go // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs cgo-fail-go1.14.go package unix type Timespec struct { Sec int64 Nsec int64 } type ScmTimestamping struct { Ts [3]_Ctype_struct_timespec }
For some reason cgo is unable to resolve __Ctype_struct_timespec
to Timespec
in Go 1.14, while it does with Go 1.13 (see below). This looks like a regression to me.
Found while trying to update the code generation in golang.org/x/sys/unix
to use Go 1.14.
What did you expect to see?
$ go1.13.8 tool cgo -godefs repro.go // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs cgo-fail-go1.14.go package unix type Timespec struct { Sec int64 Nsec int64 } type ScmTimestamping struct { Ts [3]Timespec }
What did you see instead?
See output of go1.14 tool cgo -godefs repro.go
above.