From ec4de31c5c4230dd70050c4c58def88e811b8fb5 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 28 Nov 2018 16:22:05 -0500 Subject: [PATCH] cmd/doc: treat any non-empty GOMOD as module mode 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 TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- src/cmd/doc/dirs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/doc/dirs.go b/src/cmd/doc/dirs.go index 24bd797eb5..c6f5cd9af8 100644 --- a/src/cmd/doc/dirs.go +++ b/src/cmd/doc/dirs.go @@ -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 { -- 2.50.0