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

Comments

@maxb
Copy link

@maxb 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

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Apr 29, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Apr 29, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Apr 29, 2019

Duplicate of #29268

@bcmills bcmills marked this as a duplicate of #29268 Apr 29, 2019
@bcmills bcmills closed this Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.