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/cmd/godoc: TestNoMainModule failing at head #35690

Closed
bcmills opened this issue Nov 19, 2019 · 3 comments
Closed

x/tools/cmd/godoc: TestNoMainModule failing at head #35690

bcmills opened this issue Nov 19, 2019 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Nov 19, 2019

x/tools seems to be failing in the longtest builders since CL 206886 (https://build.golang.org/log/dbcc99c87bd6e9cf27f7a29d06aab89113254310):

using GOPATH mode
2019/11/19 06:22:08 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
2019/11/19 06:22:09 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
using module mode; GOMOD=/workdir/tmp/TestWeb_Modules799547968/primarymod/repo1/go.mod
2019/11/19 06:22:10 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
2019/11/19 06:22:10 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
using GOPATH mode
2019/11/19 06:23:04 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
2019/11/19 06:23:04 packageHTML.Execute: template: package.html:266:13: executing "package.html" at <(eq $.Dirname "/src/cmd") $.DirFlat>: can't give argument to non-function eq $.Dirname "/src/cmd"
--- FAIL: TestNoMainModule (1.21s)
    godoc_test.go:472: exit status 1
using GOPATH mode
2019/11/19 06:23:07 updateMetadata: open /workdir/tmp/TestTypeAnalysis338111174/goroot/doc: no such file or directory
2019/11/19 06:23:07 updateMetadata: open /workdir/tmp/TestTypeAnalysis338111174/goroot/doc: no such file or directory
2019/11/19 06:23:07 GOROOT=/workdir/tmp/TestTypeAnalysis338111174/goroot/src/: []
2019/11/19 06:23:07 GOPATH[0]=/workdir/tmp/TestTypeAnalysis338111174/app/src/: [app]
2019/11/19 06:23:07 GOPATH[1]=/workdir/tmp/TestTypeAnalysis338111174/lib/src/: [lib]
2019/11/19 06:23:07 Loading and type-checking packages...
2019/11/19 06:23:07 Loaded 2 packages.
2019/11/19 06:23:07 Constructing SSA form...
2019/11/19 06:23:07 SSA construction complete
2019/11/19 06:23:07 Computing implements relation...
2019/11/19 06:23:07 Extracting type info...
2019/11/19 06:23:07 Visit instructions...
2019/11/19 06:23:07 Visit instructions complete
2019/11/19 06:23:07 Type analysis complete.
FAIL
FAIL	golang.org/x/tools/cmd/godoc	67.956s
@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 19, 2019
@gopherbot gopherbot added this to the Unreleased milestone Nov 19, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Nov 19, 2019
@dmitshur
Copy link
Contributor

The problem was that the behavior of go list -m all when executed in outside of any module (i.e., when go env GOMOD reports os.DevNull) has changed between 1.13 and tip, so buildList started returning an error.

I'll work around that in godoc by avoiding any calls to go list -m when GOMOD is os.DevNull, since there cannot be anything but an empty build list. This may change further when we resolve #35429.

I've filed #35728 for an inconsistency between "all" and "..." introduced on tip, because I'm not sure if that's intentional.

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 21, 2019
@gopherbot
Copy link

Change https://golang.org/cl/208258 mentions this issue: cmd/godoc: don't execute go list -m all when GOMOD is /dev/null

@dmitshur
Copy link
Contributor

Based on my understanding of the intended future behavior in #35728, I'll proceed with the approach taken in CL 208258 where the buildList function is modified to act differently when GOMOD is DevNull.

There is a cost associated with the new behavior, because the logic to compute the build list is now partially factored out of the go command (i.e., previously, one go list invocation gave a complete answer, but now we first need to check value of GOMOD before running go list). I think the benefits are worth the cost, but I wanted to point it out. /cc @jayconrod @bcmills

It's still a TODO for me to investigate the best solution to make godoc compatible with vendoring changes in Go 1.14 in issue #35429, so this may just a short term stop anyway.

@golang golang locked and limited conversation to collaborators Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants