]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/doc: treat any non-empty GOMOD as module mode
authorBryan C. Mills <bcmills@google.com>
Wed, 28 Nov 2018 21:22:05 +0000 (16:22 -0500)
committerBryan C. Mills <bcmills@google.com>
Thu, 29 Nov 2018 18:59:50 +0000 (18:59 +0000)
Previously, we were looking for the string go.mod specifically, but
the module-mode-outside-a-module logic added in CL 148517 sets GOMOD
to os.DevNull

Updates #28992

Change-Id: I62a4baaa911a495350294d78bae96be3fe4866cb
Reviewed-on: https://go-review.googlesource.com/c/151617
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/doc/dirs.go

index 24bd797eb51f9f9f0d71450514179c64ed2b91ae..c6f5cd9af8516289f336e25dec18128351398869 100644 (file)
@@ -162,7 +162,7 @@ func findCodeRoots() []Dir {
                // Check for use of modules by 'go env GOMOD',
                // which reports a go.mod file path if modules are enabled.
                stdout, _ := exec.Command("go", "env", "GOMOD").Output()
-               usingModules = bytes.Contains(stdout, []byte("go.mod"))
+               usingModules = len(bytes.TrimSpace(stdout)) > 0
        }
 
        if !usingModules {