]> Cypherpunks repositories - gostls13.git/commit
cmd/go: fix errors for commands run outside of modules
authorJay Conrod <jayconrod@google.com>
Thu, 6 Dec 2018 21:18:12 +0000 (16:18 -0500)
committerJay Conrod <jayconrod@google.com>
Mon, 10 Dec 2018 21:47:06 +0000 (21:47 +0000)
commit89df035464e63ea7c90b981266e9a77a227c456b
treea6985a1368542487c437da71d48845c9e69e6a60
parent6182d0821c60e2ec4d85e94b5c8e476ca7f75fc6
cmd/go: fix errors for commands run outside of modules

Since CL 148517, several commands (including list and get) work when
GO111MODULE=on even when no go.mod file is present. This broke an
assumption made by "fix" and "generate" which caused panics when run
with a list of .go files (whether or not the command was run inside a
module).

This change fixes those assumptions and adds test cases for other
commands run outside modules.

Fixes #29097

Change-Id: I7927559769c5d4617d73eb63f3b17e2f26d8c219
Reviewed-on: https://go-review.googlesource.com/c/153158
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/cmd/go/internal/fix/fix.go
src/cmd/go/internal/generate/generate.go
src/cmd/go/testdata/script/mod_outside.txt