set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\38114\AppData\Local\go-build
set GOENV=C:\Users\38114\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\38114\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\38114\AppData\Local\Temp\go-build025999686=/tmp/go-build -gno-record-gcc-switches
这是go的条件编译导致的,具体的方法是在go文件的第一行注释写
//+build linux
表明这个文件在Linux平台才能编译。参考代码: