Skip to content

cmd/go: suppress errors for 'go get' of package paths whose source files are all excluded by build constraints #33526

Closed
@jeanbza

Description

@jeanbza

What version of Go are you using (go version)?

$ go version
go version go1.13beta1 darwin/amd64

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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/deklerk/Library/Caches/go-build"
GOENV="/Users/deklerk/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/deklerk/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/tmp/foo/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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/c2/cvxltzcd66v5lx14hm1j76q000h16k/T/go-build777475143=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

deklerk at deklerk-macbookpro2 in /tmp/foo
$ go get google.golang.org/[email protected]
go: downloading golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961
go: downloading golang.org/x/tools v0.0.0-20190226205152-f727befe758c
go: downloading honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099
go: extracting honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099
go: extracting golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961
go: extracting golang.org/x/tools v0.0.0-20190226205152-f727befe758c
can't load package: package google.golang.org/genproto: build constraints exclude all Go files in /Users/deklerk/workspace/go/pkg/mod/google.golang.org/[email protected]
deklerk at deklerk-macbookpro2 in /tmp/foo

What did you expect to see?

deklerk at deklerk-macbookpro2 in /tmp/foo
$ go get google.golang.org/genproto/...
go: downloading golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: extracting golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding google.golang.org/genproto latest
deklerk at deklerk-macbookpro2 in /tmp/foo

What did you see instead?

(see above)

TLDR genproto has a build constraint at the root (+tools, nothing else at root), but many packages below the root do not have this build constraint. When I use go get in module mode - esp when I provide a version - I expect to only interact with the module system. Instead, it's a weird mix of module and package, and in this case though I wanted to get a module it gave me an error about a package of the same name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.modules

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions