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
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GO111MODULE=off
set GOARCH=amd64
set GOBIN=
set GOCACHE=%USERPROFILE%\AppData\Local\go-build
set GOENV=%USERPROFILE%\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=%USERPROFILE%\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=%USERPROFILE%\go;
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
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=
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\alexr\AppData\Local\Temp\go-build874774134=/tmp/go-build -gno-record-gcc-switches
What did you do?
go run .
-- main.go --
/* test*///+build !foopackage main
import"fmt"funcmain() {
fmt.Println("!foo")
}
-- main2.go --
/* test*///+build foopackage main
import"fmt"funcmain() {
fmt.Println("foo")
}
What did you expect to see?
Output: !foo
This works if instead of /* */ comments I used // comments in the same places
What did you see instead?
.\main2.go:13:6: main redeclared in this block
previous declaration at .\main.go:13:6
The text was updated successfully, but these errors were encountered:
This is working as intended, go vet will highlight the error that the build tag must be the first line of the file and there must be a space between // and +build
I'm sorry, my previous comment was not productive.
I'm not sure why vet isn't flagging your incorrect build tag, but I'm guessing it is because the tag is both in the wrong place, it isn't the first line of the file, and there is no space between the // and +build. There is a newline following the build tag, which is necessary, but my guess is, given there is an unlimited number of constructions which are not valid build tags, vet just gave up. I don't know if there is a vet analyser for //+build anywhere in the file, that seems like something that would be useful.
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 run .
-- main.go --
-- main2.go --
What did you expect to see?
Output:
!foo
This works if instead of
/* */
comments I used//
comments in the same placesWhat did you see instead?
The text was updated successfully, but these errors were encountered: