On Mon, Jun 19, 2023 at 11:46 AM '方佳文' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> Hi, maintainers of https://github.com/golang/glog:
>
> There is a bug in golang/glog that the CGO condition is wrong.
>
> https://github.com/golang/glog/blob/03ad3c2a3f1c767129f0b355507de7ae615f53b8/glog_file_linux.go#L17
>
> //go:build linux
>
> https://github.com/golang/glog/blob/03ad3c2a3f1c767129f0b355507de7ae615f53b8/glog_file_other.go#L17
>
> //go:build !(unix || windows)
>
> On the Linux platform, the function will be declared twice. The problem is 
> actually caused by the wrong CGO conditions, instead of the low Go version.
>
> GOOS=linux ~/go1.18/bin/go build -o exe ./example/main.go
> # github.com/golang/glog
> ../../go/pkg/mod/github.com/golang/glog@v1.1.1/glog_file_other.go:27:6: 
> abortProcess redeclared in this block
>         
> ../../go/pkg/mod/github.com/golang/glog@v1.1.1/glog_file_linux.go:33:6: other 
> declaration of abortProcess
> note: module requires Go 1.19
>
> The correct condition should be:
>
> //go:build !(unix || windows || linux)
>
> Because you already have glog_file_linux.go

The build constraint "unix" matches "GOOS=linux".

Your problem is that the "unix" build constraint was only added in Go
1.19 (see https://go.dev/doc/go1.19#go-unix).  As the error message
above says "note: module requires Go 1.19".  Go 1.18 is no longer
supported, and the glog package requires at least Go 1.19.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUSwKMOyhdpxBCwPPMx13-eM1MZZobfdJ%3DLyitvYFrUcg%40mail.gmail.com.

Reply via email to