Repository: go
Issue: cmd/go: emit a clearer error message when building with -tags=ignore
Labels: NeedsFix,GoCommand

<!--
Please answer these questions before submitting your issue. Thanks!
For questions please use one of our forums: https://github.com/golang/go/wiki/Questions
-->

### What version of Go are you using (`go version`)?

<pre>
$ go version 
go version go1.16.5 darwin/amd64
</pre>

### Does this issue reproduce with the latest release?
Yes


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/temporaryadmin/Library/Caches/go-build"
GOENV="/Users/temporaryadmin/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/temporaryadmin/go/pkg/mod"
GONOPROXY="github.com/deliveryhero/pipeline"
GONOSUMDB="github.com/deliveryhero/pipeline"
GOOS="darwin"
GOPATH="/Users/temporaryadmin/go"
GOPRIVATE="github.com/deliveryhero/pipeline"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/temporaryadmin/go/src/github.com/deliveryhero/dh-vt-ncr-click-service/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wj/mzsjw5sj3r9f9y3dwph2bwz00000gp/T/go-build3374550061=/tmp/go-build -gno-record-gcc-switches -fno-common"
</pre></details>

### What did you do?
1. Add a `//+build ignore` build flag to the top of a test file
2. Run `go test -v --tags=ignore ../.`
<!--
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
-->



### What did you expect to see?
My test output


### What did you see instead?
<details><summary><code>go test -v --tags=ignore ../.</code> Output</summary><br><pre>
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports net/http
	imports context: import cycle not allowed
/usr/local/go/src/crypto/tls/key_agreement.go:9:2: found packages md5 (example_test.go) and main (gen.go) in /usr/local/go/src/crypto/md5
/usr/local/go/src/net/http/client.go:14:2: found packages tls (alert.go) and main (generate_cert.go) in /usr/local/go/src/crypto/tls
/usr/local/go/src/crypto/tls/cipher_suites.go:16:2: found packages x509 (cert_pool.go) and main (root_ios_gen.go) in /usr/local/go/src/crypto/x509
../../../../pkg/mod/golang.org/x/text@v0.3.6/internal/gen/code.go:9:2: found packages gob (codec_test.go) and main (decgen.go) in /usr/local/go/src/encoding/gob
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports bytes
	imports errors: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports strconv
	imports flag: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports fmt: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/ast: import cycle not allowed
/usr/local/go/src/go/build/build.go:12:2: found packages doc (comment.go) and main (headscan.go) in /usr/local/go/src/go/doc
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/format: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports go/scanner: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports go/token: import cycle not allowed
../../../../pkg/mod/golang.org/x/text@v0.3.6/secure/precis/options.go:8:2: found packages cases (cases.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/cases
../../../../pkg/mod/golang.org/x/text@v0.3.6/unicode/rangetable/gen.go:20:2: found packages collate (collate.go) and main (maketables.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/collate
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports github.com/googleapis/gax-go/v2
	imports google.golang.org/grpc
	imports google.golang.org/grpc/internal/transport
	imports golang.org/x/net/http2
	imports golang.org/x/net/http/httpguts
	imports golang.org/x/net/idna
	imports golang.org/x/text/secure/bidirule
	imports golang.org/x/text/unicode/bidi
	imports golang.org/x/text/internal/gen
	imports golang.org/x/text/unicode/cldr
	imports golang.org/x/text/internal/gen: import cycle not allowed
../../../../pkg/mod/golang.org/x/text@v0.3.6/language/coverage.go:11:2: found packages language (common.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/internal/language
../../../../pkg/mod/golang.org/x/text@v0.3.6/language/language.go:16:2: found packages compact (compact.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/internal/language/compact
../../../../pkg/mod/golang.org/x/text@v0.3.6/internal/colltab/colltab.go:12:2: found packages language (coverage.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/language
../../../../pkg/mod/github.com/jackc/pgconn@v1.8.0/auth_scram.go:26:2: found packages precis (benchmark_test.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/secure/precis
../../../../pkg/mod/golang.org/x/text@v0.3.6/secure/bidirule/bidirule.go:16:2: found packages bidi (bidi.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/unicode/bidi
../../../../pkg/mod/golang.org/x/text@v0.3.6/internal/gen/gen.go:39:2: found packages cldr (base.go) and main (makexml.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/unicode/cldr
../../../../pkg/mod/golang.org/x/text@v0.3.6/internal/colltab/table.go:10:2: found packages norm (composition.go) and main (maketables.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/unicode/norm
../../../../pkg/mod/golang.org/x/text@v0.3.6/secure/precis/gen.go:23:2: import "golang.org/x/text/unicode/rangetable" is a program, not an importable package
../../../../pkg/mod/golang.org/x/text@v0.3.6/secure/precis/profile.go:17:2: found packages width (common_test.go) and main (gen.go) in /Users/temporaryadmin/go/pkg/mod/golang.org/x/text@v0.3.6/width
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports net/http
	imports crypto/tls
	imports crypto/md5
	imports text/template
	imports internal/fmtsort: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports internal/reflectlite: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports strconv
	imports log
	imports os
	imports io/fs: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports strconv
	imports log
	imports os
	imports internal/poll
	imports syscall
	imports log: import cycle not allowed
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports strconv
	imports math: import cycle not allowed
/usr/local/go/src/math/fma.go:7:8: found packages bits (bits.go) and main (make_examples.go) in /usr/local/go/src/math/bits
/usr/local/go/src/math/big/int.go:12:2: found packages rand (example_test.go) and main (gen_cooked.go) in /usr/local/go/src/math/rand
/usr/local/go/src/time/genzabbrs.go:22:2: found packages http (alpn_test.go) and main (triv.go) in /usr/local/go/src/net/http
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports strconv
	imports log
	imports os
	imports internal/poll
	imports syscall
	imports os: import cycle not allowed
/usr/local/go/src/net/http/triv.go:18:2: found packages exec (bench_test.go) and main (read3.go) in /usr/local/go/src/os/exec
package github.com/deliveryhero/dh-vt-ncr-click-service/internal/click
	imports cloud.google.com/go/pubsub
	imports cloud.google.com/go/iam
	imports context
	imports errors
	imports internal/reflectlite
	imports runtime
	imports flag
	imports fmt
	imports internal/fmtsort
	imports reflect
	imports math
	imports math/bits
	imports go/format
	imports go/ast
	imports go/scanner
	imports go/token
	imports sort
	imports go/parser
	imports io/fs
	imports time
	imports encoding/xml
	imports reflect: import cycle not allowed
/usr/local/go/src/internal/reflectlite/value.go:9:2: found packages runtime (alg.go) and main (mkduff.go) in /usr/local/go/src/runtime
/usr/local/go/src/runtime/internal/math/math.go:7:8: found packages sys (arch.go) and main (gengoos.go) in /usr/local/go/src/runtime/internal/sys
/usr/local/go/src/go/token/position.go:9:2: found packages sort (example_interface_test.go) and main (genzfunc.go) in /usr/local/go/src/sort
/usr/local/go/src/encoding/xml/marshal.go:14:2: found packages strconv (atob.go) and main (makeisprint.go) in /usr/local/go/src/strconv
/usr/local/go/src/internal/poll/errno_unix.go:9:8: found packages syscall (bpf_darwin.go) and main (mkasm.go) in /usr/local/go/src/syscall
/usr/local/go/src/io/fs/fs.go:12:2: found packages time (example_test.go) and main (genzabbrs.go) in /usr/local/go/src/time
</pre></details>