Open perillo opened 3 years ago
CC @rsc via https://dev.golang.org/owners.
I obtain a very similar error but on Windows.
$ go version set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\user\AppData\Local\go-build set GOENV=C:\Users\user\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\user\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\user\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=C:\Program Files\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.17 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=E:\somerepo\go.mod 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\user\AppData\Local\Temp\go-build2520574871=/tmp/go-build -gno-record-gcc-switches
Steps to reproduce:
Clone some repository using syscall
, in my case:
git clone https://github.com/qdm12/gluetun.git .
Run tests with go test -tags=linux ./...
Errors shown as:
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:8:7: GOOS redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:8:14: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:10:7: GoosAix redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:10:17: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:11:7: GoosAndroid redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:11:21: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:12:7: GoosDarwin redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:12:20: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:13:7: GoosDragonfly redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:13:23: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:14:7: GoosFreebsd redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:14:21: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:15:7: GoosHurd redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:15:18: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:16:7: GoosIllumos redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:16:21: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:17:7: GoosIos redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:17:17: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:18:7: GoosJs redeclared in this block
C:\Program Files\Go\src\runtime\internal\sys\zgoos_linux.go:18:16: previous declaration
C:\Program Files\Go\src\runtime\internal\sys\zgoos_windows.go:18:7: too many errors
Followed by a few [build failed]
for each sub-package of the repository
Golang 1.20.2 here, tried the same lib as above after seeing it on another repo.
go test -tags=windows ./...
go: downloading golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224
# internal/goos
/usr/local/go/src/internal/goos/zgoos_windows.go:7:7: GOOS redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:7:7: other declaration of GOOS
/usr/local/go/src/internal/goos/zgoos_windows.go:9:7: IsAix redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:9:7: other declaration of IsAix
/usr/local/go/src/internal/goos/zgoos_windows.go:10:7: IsAndroid redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:10:7: other declaration of IsAndroid
/usr/local/go/src/internal/goos/zgoos_windows.go:11:7: IsDarwin redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:11:7: other declaration of IsDarwin
/usr/local/go/src/internal/goos/zgoos_windows.go:12:7: IsDragonfly redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:12:7: other declaration of IsDragonfly
/usr/local/go/src/internal/goos/zgoos_windows.go:13:7: IsFreebsd redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:13:7: other declaration of IsFreebsd
/usr/local/go/src/internal/goos/zgoos_windows.go:14:7: IsHurd redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:14:7: other declaration of IsHurd
/usr/local/go/src/internal/goos/zgoos_windows.go:15:7: IsIllumos redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:15:7: other declaration of IsIllumos
/usr/local/go/src/internal/goos/zgoos_windows.go:16:7: IsIos redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:16:7: other declaration of IsIos
/usr/local/go/src/internal/goos/zgoos_windows.go:17:7: IsJs redeclared in this block
/usr/local/go/src/internal/goos/zgoos_linux.go:17:7: other declaration of IsJs
/usr/local/go/src/internal/goos/zgoos_windows.go:17:7: too many errors
FAIL github.com/qdm12/gluetun/internal/configuration/settings [build failed]
? github.com/qdm12/gluetun/internal/constants/openvpn [no test files]
FAIL github.com/qdm12/gluetun/internal/configuration/sources/env [build failed]
? github.com/qdm12/gluetun/internal/constants/vpn [no test files]
FAIL github.com/qdm12/gluetun/internal/constants/providers [build failed]
FAIL github.com/qdm12/gluetun/internal/dns [build failed]
FAIL github.com/qdm12/gluetun/internal/firewall [build failed]
FAIL github.com/qdm12/gluetun/internal/healthcheck [build failed]
FAIL github.com/qdm12/gluetun/internal/httpserver [build failed]
FAIL github.com/qdm12/gluetun/internal/models [build failed]
FAIL github.com/qdm12/gluetun/internal/netlink [build failed]
FAIL github.com/qdm12/gluetun/internal/openvpn [build failed]
FAIL github.com/qdm12/gluetun/internal/openvpn/extract [build failed]
FAIL github.com/qdm12/gluetun/internal/pprof [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/common [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/custom [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/expressvpn [build failed]
? github.com/qdm12/gluetun/internal/provider/privateinternetaccess/presets [no test files]
FAIL github.com/qdm12/gluetun/internal/provider/ipvanish/updater [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/ivpn [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/ivpn/updater [build failed]
? github.com/qdm12/gluetun/internal/provider/surfshark/servers [no test files]
FAIL github.com/qdm12/gluetun/internal/provider/mullvad [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/mullvad/updater [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/privateinternetaccess [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/slickvpn/updater [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/surfshark/updater [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/utils [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/vpnsecure/updater [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/wevpn [build failed]
FAIL github.com/qdm12/gluetun/internal/provider/windscribe [build failed]
FAIL github.com/qdm12/gluetun/internal/routing [build failed]
FAIL github.com/qdm12/gluetun/internal/storage [build failed]
FAIL github.com/qdm12/gluetun/internal/tun [build failed]
FAIL github.com/qdm12/gluetun/internal/updater/html [build failed]
FAIL github.com/qdm12/gluetun/internal/updater/resolver [build failed]
FAIL github.com/qdm12/gluetun/internal/wireguard [build failed]
FAIL
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go vet -tags=windows
on a Linux host.What did you expect to see?
An error, explaining that
"windows"
should not be used as a build tag.What did you see instead?
A similar error is reported when a different arch is specified as a build tag.
Is there a reason why a build tag with the same name of an os or arch is not rejected?
Thanks.