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

x/tools/go/packages: TestLoadImportsGraph failure with custom GOCACHE [1.11 backport] #29944

Closed
gopherbot opened this issue Jan 25, 2019 · 7 comments

Comments

@gopherbot
Copy link

commented Jan 25, 2019

@andybons requested issue #29445 to be considered for backport to the next 1.11 minor release.

This is causing trybots to fail on release-branch-go1.11: https://storage.googleapis.com/go-build-log/8c10ce16/linux-amd64_6f9c601b.log (from golang.org/cl/159740)

@gopherbot please open a backport issue for 1.11

@andybons

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

@mvdan

This comment has been minimized.

Copy link
Member

commented Jan 26, 2019

I'm not sure I follow - the fix I submitted was in the x/tools repo, not the main go repo. So how would a backport to 1.11.6 work?

@andybons

This comment has been minimized.

Copy link
Member

commented Jan 26, 2019

The tools repo has a 1.11 release branch as well.

@dmitshur

This comment has been minimized.

Copy link
Member

commented Feb 25, 2019

@mvdan Are you planning on making a backport of CL 156977 onto the release-branch.go.1.11 of x/tools subrepo, or would you prefer for someone else to do that?

@mvdan

This comment has been minimized.

Copy link
Member

commented Feb 25, 2019

Not planning on it, so it's up for grabs. I only fixed the bug in master as it was annoying me :)

@dmitshur dmitshur added help wanted and removed help wanted labels Feb 25, 2019

@dmitshur dmitshur self-assigned this Feb 25, 2019

@gopherbot

This comment has been minimized.

Copy link
Author

commented Feb 25, 2019

Change https://golang.org/cl/163780 mentions this issue: [release-branch.go1.11] go/packages: make tests pass with custom GOCACHE

@gopherbot

This comment has been minimized.

Copy link
Author

commented Feb 25, 2019

Closed by merging e9f45831faab4562ce3f53f7196b67c08f948e86 to release-branch.go1.11.

@gopherbot gopherbot closed this Feb 25, 2019

gopherbot pushed a commit to golang/tools that referenced this issue Feb 25, 2019
[release-branch.go1.11] go/packages: make tests pass with custom GOCACHE
This commit was merged earlier with some failing trybots, so it was
reverted. This is a re-submission.

Before this change, a test would fail:

	$ GOCACHE=$HOME/go/cache go test
	--- FAIL: TestLoadImportsGraph (1.05s)
	    packages_test.go:225: subdir/d.test.Srcs = [cf570d60b25cde4f49bbe5f69d3ed407f2d7f1fbc500b8807da726fb19b8f588-d], want [0.go]
	FAIL

This is because it assumed that the user hadn't set their own GOCACHE,
and thus that all source files in the cache would be under the default
"go-build" cache directory.

We could fix this via os.Getenv("GOCACHE"), but a simpler mechanism is
to see if the source file has an extension. Source files don't have an
extension in GOCACHE, so that's much simpler to detect.

After this change:

	$ GOCACHE=$HOME/go/cache go test
	PASS

On release-branch.go1.11, golist_fallback.go did not yet have the code
added that would need to be fixed, so nothing is being backported to it
in this change.

While at it, gofmt.

Updates golang/go#29445
Fixes golang/go#29944

Change-Id: I21fc59f13f00bea1f9a8a80e0438825f1a36ac3e
Reviewed-on: https://go-review.googlesource.com/c/156977
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/163780
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.