Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: "go get -d" can error with "build constraints exclude all Go files" in 1.12 #31661

Closed
maxb opened this issue Apr 24, 2019 · 3 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@maxb
Copy link

maxb commented Apr 24, 2019

In Go 1.12, using module mode "go get -d" now spuriously errors "build constraints exclude all Go files", if invoked on a module whose root package does indeed have build constraints excluding all Go files. A module for which this is the case, is google.golang.org/genproto

However, it should not, as I only asked for go get to download the module and add it to my go.mod file, not to build the root package of the module.

This worked in Go 1.11.

What did you do?

Download the go1.11.9 and go1.12.4 distributions and unpack (I put them in /opt/go-$goversion)

Create the following script as gorepro.sh, which essentially just runs "go get -d google.golang.org/genproto" in a clean environment and echos the exit status:

#!/bin/sh
goversion=$1
rm -rf ~/.cache/go-build
tmpdir=$(mktemp -d)
cd "$tmpdir"
/opt/go-$goversion/bin/go mod init xyz.local/sandbox
/opt/go-$goversion/bin/go get -d google.golang.org/genproto
echo $?

What did you expect to see?

Using Go 1.11.x it works, returning zero exit status:

$ ./gorepro.sh 1.11.9
go: creating new go.mod: module xyz.local/sandbox
go: finding google.golang.org/genproto latest
go: finding github.com/golang/protobuf v1.2.0
go: finding google.golang.org/grpc v1.19.0
go: finding golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6
go: finding golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961
go: finding golang.org/x/exp v0.0.0-20190121172915-509febef88a4
go: finding golang.org/x/tools v0.0.0-20190226205152-f727befe758c
go: finding golang.org/x/net v0.0.0-20190213061140-3a22650c66bd
go: finding honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding github.com/client9/misspell v0.3.4
go: finding github.com/BurntSushi/toml v0.3.1
go: finding github.com/golang/mock v1.1.1
go: finding golang.org/x/tools v0.0.0-20190114222345-bf090417da8b
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding golang.org/x/text v0.3.0
go: finding google.golang.org/appengine v1.1.0
go: finding cloud.google.com/go v0.26.0
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding google.golang.org/appengine v1.4.0
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: downloading google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7
0

What did you see instead?

Using Go 1.12.x it now fails:

$ ./gorepro.sh 1.12.4
go: creating new go.mod: module xyz.local/sandbox
go: finding google.golang.org/genproto latest
package google.golang.org/genproto: build constraints exclude all Go files in /home/maxb/go/pkg/mod/google.golang.org/genproto@v0.0.0-20190418145605-e7d98fc518a7
1

System details

go version go1.12.4 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/maxb/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/maxb/go"
GOPROXY=""
GORACE=""
GOROOT="/opt/go-1.12.4"
GOTMPDIR=""
GOTOOLDIR="/opt/go-1.12.4/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
uname -sr: Linux 5.0.0-13-generic
Distributor ID:	Ubuntu
Description:	Ubuntu 19.04
Release:	19.04
Codename:	disco
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.29-0ubuntu2) stable release version 2.29.
gdb --version: GNU gdb (Ubuntu 8.2.91.20190405-0ubuntu3) 8.2.91.20190405-git
@odeke-em odeke-em changed the title Go 1.12 regression: "go get -d" can error with "build constraints exclude all Go files" cmd/go: "go get -d" can error with "build constraints exclude all Go files" -- possible Go1.12 regression Apr 25, 2019
@katiehockman katiehockman changed the title cmd/go: "go get -d" can error with "build constraints exclude all Go files" -- possible Go1.12 regression cmd/go: "go get -d" can error with "build constraints exclude all Go files" in 1.12 Apr 29, 2019
@katiehockman katiehockman added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 29, 2019
@katiehockman
Copy link
Contributor

/cc @bcmills @jayconrod

@bcmills
Copy link
Contributor

bcmills commented Apr 29, 2019

See #29268 (comment).

@bcmills
Copy link
Contributor

bcmills commented Apr 29, 2019

Duplicate of #29268

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants