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 install -x -n is not empty even if nothing needs building #24396

Closed
eliasnaur opened this issue Mar 14, 2018 · 9 comments
Closed

cmd/go: go install -x -n is not empty even if nothing needs building #24396

eliasnaur opened this issue Mar 14, 2018 · 9 comments
Milestone

Comments

@eliasnaur
Copy link
Contributor

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

go version devel +fdf5aaf555 Mon Mar 12 15:05:53 2018 +0000 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/elias/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/elias/dev/go"
GORACE=""
GOROOT="/home/elias/dev/go-tip"
GOTMPDIR=""
GOTOOLDIR="/home/elias/dev/go-tip/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build596110402=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go install golang.org/x/mobile/cmd/gomobile
$ go install -x -n golang.org/x/mobile/cmd/gomobile
rm -r $WORK/b001/

What did you expect to see?

Nothing output from the second command

What did you see instead?

rm -r $WORK/b001/

This is the root cause for #24389. gomobile version uses go install -x -n to determine if the gomobile binary is up to date by checking that its output is empty.

@andybons
Copy link
Member

@ianlancetaylor @rsc

@andybons andybons added this to the Go1.11 milestone Mar 14, 2018
@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 14, 2018
@ianlancetaylor
Copy link
Contributor

I'll look into this, but couldn't you use go list -f '{{.Stale}}' instead?

@eliasnaur
Copy link
Contributor Author

eliasnaur commented Mar 27, 2018

That option didn't occur to me. However, it doesn't seem to work in my case:

$ go version
go version devel +a44c72823c Tue Mar 27 15:06:53 2018 +0000 linux/amd64
$ go install golang.org/x/mobile/cmd/gomobile
$ go list -f '{{.Stale}}' golang.org/x/mobile/cmd/gomobile
true
$ go list -f '{{.StaleReason}}' golang.org/x/mobile/cmd/gomobile
stale dependency: golang.org/x/mobile/internal/binres

I can manually go install the dependency:

$ go install golang.org/x/mobile/internal/binres
$ go list -f '{{.Stale}}' golang.org/x/mobile/cmd/gomobile
false

But as soon as I blow away my $GOPATH/pkg dir, the problem reappears:

$ rm -rf $GOPATH/pkg
$ go install golang.org/x/mobile/cmd/gomobile
$ go list -f '{{.Stale}}' golang.org/x/mobile/cmd/gomobile
true
$ go list -f '{{.StaleReason}}' golang.org/x/mobile/cmd/gomobile
stale dependency: golang.org/x/mobile/internal/binres

Edit: For the offending package:

$ go list -f '{{.Stale}}' golang.org/x/mobile/internal/binres
true
$ go list -f '{{.StaleReason}}' golang.org/x/mobile/internal/binres
target missing

Did I miss something?

@ianlancetaylor
Copy link
Contributor

I don't think you missed anything. Filed #24558.

@gopherbot
Copy link

Change https://golang.org/cl/102619 mentions this issue: cmd/go: with -x, don't report removing a non-existent objdir

@ianlancetaylor
Copy link
Contributor

Reopening for 1.10.1, since it affects mobile builds.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.11, Go1.10.1 Mar 27, 2018
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 27, 2018
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 27, 2018
@andybons
Copy link
Member

andybons commented Mar 27, 2018

No description provided.

@andybons andybons added CherryPickApproved Used during the release process for point releases and removed NeedsFix The path to resolution is known, but the work has not been done. labels Mar 27, 2018
@gopherbot
Copy link

Change https://golang.org/cl/102794 mentions this issue: [release-branch.go1.10] cmd/go: with -x, don't report removing a non-existent objdir

@ianlancetaylor
Copy link
Contributor

This doesn't fix the gomobile problem, so not important for 1.10.1, so closing again.

@andybons andybons removed the CherryPickApproved Used during the release process for point releases label Mar 28, 2018
@andybons andybons modified the milestones: Go1.10.1, Go1.11 Mar 28, 2018
@golang golang locked and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants