cmd/go: import from main repo at go1.11beta3

One small adjustment needed in patch.txt.

Rewrote README.md to clarify status of this repo.

Change-Id: Ibe646468f864edb1a6bf7692a3d560170d231801
Reviewed-on: https://go-review.googlesource.com/127956
Reviewed-by: Bryan C. Mills <bcmills@google.com>
diff --git a/README.md b/README.md
index a58dcad..0b34546 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,13 @@
-# Versioned Go Prototype (vgo)
+# Versioned Go Command (vgo)
 
-This repository holds a prototype of what the go command
-might look like with integrated support for package versioning.
+This repository holds a standalone implementation of a version-aware `go` command,
+allowing users with a Go 1.10 toolchain to use the new Go 1.11 module support.
 
-See [research.swtch.com/vgo](https://research.swtch.com/vgo)
-for documents about the design.
+The code in this repo is auto-generated from and should behave exactly like
+the Go 1.11 `go` command, with two changes:
+
+  - It behaves as if the `GO111MODULE` variable defaults to `on`.
+  - When using a Go 1.10 toolchain, `go` `vet` during `go` `test` is disabled.
 
 ## Download/Install
 
@@ -17,10 +20,10 @@
 
 See [CONTRIBUTING.md](CONTRIBUTING.md).
 
-This is still a very early prototype.
-You are likely to run into bugs.
 Please file bugs in the main Go issue tracker,
 [golang.org/issue](https://golang.org/issue),
-and put the prefix `x/vgo:` in the issue title.
+and put the prefix `x/vgo:` in the issue title,
+or `cmd/go:` if you have confirmed that the same
+bug is present in the Go 1.11 module support.
 
 Thank you.
diff --git a/patch.txt b/patch.txt
index 3276850..53f4212 100644
--- a/patch.txt
+++ b/patch.txt
@@ -22,16 +22,10 @@
 
  import (
  	"bytes"
-@@ -120,8 +120,8 @@
- 	}
-
- 	if canRun {
+@@ -120,2 +120,2 @@
  		testGo = filepath.Join(testTmpDir, "testgo"+exeSuffix)
 -		args := []string{"build", "-tags", "testgo", "-o", testGo}
 +		args := []string{"build", "-tags", "testgo", "-o", testGo, "../../.."}
- 		if race.Enabled {
- 			args = append(args, "-race")
- 		}
 @@ -867,7 +870,9 @@
  	tg.grepBoth("FAIL.*badtest/badvar", "test did not run everything")
  }
diff --git a/vendor/cmd/go/go_test.go b/vendor/cmd/go/go_test.go
index d23f3cf..a0a29b9 100644
--- a/vendor/cmd/go/go_test.go
+++ b/vendor/cmd/go/go_test.go
@@ -105,6 +105,7 @@
 
 var testGo string
 var testTmpDir string
+var testBin string
 
 // The TestMain function creates a go command for testing purposes and
 // deletes it after the tests have been run.
@@ -133,7 +134,11 @@
 	}
 
 	if canRun {
-		testGo = filepath.Join(testTmpDir, "testgo"+exeSuffix)
+		testBin = filepath.Join(testTmpDir, "testbin")
+		if err := os.Mkdir(testBin, 0777); err != nil {
+			log.Fatal(err)
+		}
+		testGo = filepath.Join(testBin, "go"+exeSuffix)
 		args := []string{"build", "-tags", "testgo", "-o", testGo, "../../.."}
 		if race.Enabled {
 			args = append(args, "-race")
@@ -219,13 +224,11 @@
 	os.Unsetenv("GOBIN")
 	os.Unsetenv("GOPATH")
 	os.Unsetenv("GIT_ALLOW_PROTOCOL")
-	if home, ccacheDir := os.Getenv("HOME"), os.Getenv("CCACHE_DIR"); home != "" && ccacheDir == "" {
-		// On some systems the default C compiler is ccache.
-		// Setting HOME to a non-existent directory will break
-		// those systems. Set CCACHE_DIR to cope. Issue 17668.
-		os.Setenv("CCACHE_DIR", filepath.Join(home, ".ccache"))
-	}
 	os.Setenv("HOME", "/test-go-home-does-not-exist")
+	// On some systems the default C compiler is ccache.
+	// Setting HOME to a non-existent directory will break
+	// those systems. Disable ccache and use real compiler. Issue 17668.
+	os.Setenv("CCACHE_DISABLE", "1")
 	if os.Getenv("GOCACHE") == "" {
 		os.Setenv("GOCACHE", testGOCACHE) // because $HOME is gone
 	}
@@ -1470,12 +1473,6 @@
 	tg.grepStderr(`([\\/]compile|gccgo).* (-p p1|-fgo-pkgpath=p1).*p1\.go`, "should have run compile -p p1 p1.go")
 }
 
-// The runtime version string takes one of two forms:
-// "go1.X[.Y]" for Go releases, and "devel +hash" at tip.
-// Determine whether we are in a released copy by
-// inspecting the version.
-var isGoRelease = strings.HasPrefix(runtime.Version(), "go1")
-
 // Issue 12690
 func TestPackageNotStaleWithTrailingSlash(t *testing.T) {
 	skipIfGccgo(t, "gccgo does not have GOROOT")
@@ -1764,7 +1761,7 @@
 	tg.run("list", "-test", "sort")
 	tg.grepStdout(`^sort.test$`, "missing test main")
 	tg.grepStdout(`^sort$`, "missing real sort")
-	tg.grepStdoutNot(`^sort \[sort.test\]$`, "unexpected test copy of sort")
+	tg.grepStdout(`^sort \[sort.test\]$`, "unexpected test copy of sort")
 	tg.grepStdoutNot(`^testing \[sort.test\]$`, "unexpected test copy of testing")
 	tg.grepStdoutNot(`^testing$`, "unexpected real copy of testing")
 
@@ -1783,7 +1780,7 @@
 	tg.grepStdoutNot(`^sort`, "unexpected sort")
 }
 
-func TestGoListCgo(t *testing.T) {
+func TestGoListCompiledCgo(t *testing.T) {
 	tg := testgo(t)
 	defer tg.cleanup()
 	tg.parallel()
@@ -1795,18 +1792,26 @@
 		t.Skip("net does not use cgo")
 	}
 	if strings.Contains(tg.stdout.String(), tg.tempdir) {
-		t.Fatalf(".CgoFiles without -cgo unexpectedly mentioned cache %s", tg.tempdir)
+		t.Fatalf(".CgoFiles unexpectedly mentioned cache %s", tg.tempdir)
 	}
-	tg.run("list", "-cgo", "-f", `{{join .CgoFiles "\n"}}`, "net")
+	tg.run("list", "-compiled", "-f", `{{.Dir}}{{"\n"}}{{join .CompiledGoFiles "\n"}}`, "net")
 	if !strings.Contains(tg.stdout.String(), tg.tempdir) {
-		t.Fatalf(".CgoFiles with -cgo did not mention cache %s", tg.tempdir)
+		t.Fatalf(".CompiledGoFiles with -compiled did not mention cache %s", tg.tempdir)
 	}
+	dir := ""
 	for _, file := range strings.Split(tg.stdout.String(), "\n") {
 		if file == "" {
 			continue
 		}
+		if dir == "" {
+			dir = file
+			continue
+		}
+		if !strings.Contains(file, "/") && !strings.Contains(file, `\`) {
+			file = filepath.Join(dir, file)
+		}
 		if _, err := os.Stat(file); err != nil {
-			t.Fatalf("cannot find .CgoFiles result %s: %v", file, err)
+			t.Fatalf("cannot find .CompiledGoFiles result %s: %v", file, err)
 		}
 	}
 }
@@ -5554,6 +5559,21 @@
 	tg.grepStderrNot(`invalid.*constraint`, "did diagnose bad build constraint in vetxonly mode")
 }
 
+func TestTestSkipVetAfterFailedBuild(t *testing.T) {
+	tg := testgo(t)
+	defer tg.cleanup()
+	tg.parallel()
+
+	tg.tempFile("x_test.go", `package x
+		func f() {
+			return 1
+		}
+	`)
+
+	tg.runFail("test", tg.path("x_test.go"))
+	tg.grepStderrNot(`vet`, "vet should be skipped after the failed build")
+}
+
 func TestTestVetRebuild(t *testing.T) {
 	tg := testgo(t)
 	defer tg.cleanup()
diff --git a/vendor/cmd/go/go_windows_test.go b/vendor/cmd/go/go_windows_test.go
index c67954d..8836269 100644
--- a/vendor/cmd/go/go_windows_test.go
+++ b/vendor/cmd/go/go_windows_test.go
@@ -97,7 +97,7 @@
 	// will make all files created in TestACL/tmp have different
 	// security attributes to the files created in TestACL.
 	runIcacls(t, newtmpdir,
-		"/grant", "guest:(oi)(ci)f", // add Guest user to have full access
+		"/grant", "*S-1-5-32-546:(oi)(ci)f", // add Guests group to have full access
 	)
 
 	src := filepath.Join(tmpdir, "main.go")
diff --git a/vendor/cmd/go/internal/base/base.go b/vendor/cmd/go/internal/base/base.go
index d0c6c0e..dac4bc9 100644
--- a/vendor/cmd/go/internal/base/base.go
+++ b/vendor/cmd/go/internal/base/base.go
@@ -46,25 +46,43 @@
 	// CustomFlags indicates that the command will do its own
 	// flag parsing.
 	CustomFlags bool
+
+	// Commands lists the available commands and help topics.
+	// The order here is the order in which they are printed by 'go help'.
+	// Note that subcommands are in general best avoided.
+	Commands []*Command
 }
 
-// Commands lists the available commands and help topics.
-// The order here is the order in which they are printed by 'go help'.
-var Commands []*Command
+var Go = &Command{
+	UsageLine: "go",
+	Long:      `Go is a tool for managing Go source code.`,
+	// Commands initialized in package main
+}
 
-// Name returns the command's name: the first word in the usage line.
-func (c *Command) Name() string {
+// LongName returns the command's long name: all the words in the usage line between "go" and a flag or argument,
+func (c *Command) LongName() string {
 	name := c.UsageLine
-	i := strings.Index(name, " ")
-	if i >= 0 {
+	if i := strings.Index(name, " ["); i >= 0 {
 		name = name[:i]
 	}
+	if name == "go" {
+		return ""
+	}
+	return strings.TrimPrefix(name, "go ")
+}
+
+// Name returns the command's short name: the last word in the usage line before a flag or argument.
+func (c *Command) Name() string {
+	name := c.LongName()
+	if i := strings.LastIndex(name, " "); i >= 0 {
+		name = name[i+1:]
+	}
 	return name
 }
 
 func (c *Command) Usage() {
 	fmt.Fprintf(os.Stderr, "usage: %s\n", c.UsageLine)
-	fmt.Fprintf(os.Stderr, "Run 'go help %s' for details.\n", c.Name())
+	fmt.Fprintf(os.Stderr, "Run 'go help %s' for details.\n", c.LongName())
 	os.Exit(2)
 }
 
diff --git a/vendor/cmd/go/internal/base/goflags.go b/vendor/cmd/go/internal/base/goflags.go
new file mode 100644
index 0000000..2f50b50
--- /dev/null
+++ b/vendor/cmd/go/internal/base/goflags.go
@@ -0,0 +1,152 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package base
+
+import (
+	"flag"
+	"fmt"
+	"os"
+	"runtime"
+	"strings"
+
+	"cmd/go/internal/cfg"
+)
+
+var (
+	goflags   []string                // cached $GOFLAGS list; can be -x or --x form
+	knownFlag = make(map[string]bool) // flags allowed to appear in $GOFLAGS; no leading dashes
+)
+
+// AddKnownFlag adds name to the list of known flags for use in $GOFLAGS.
+func AddKnownFlag(name string) {
+	knownFlag[name] = true
+}
+
+// GOFLAGS returns the flags from $GOFLAGS.
+// The list can be assumed to contain one string per flag,
+// with each string either beginning with -name or --name.
+func GOFLAGS() []string {
+	InitGOFLAGS()
+	return goflags
+}
+
+// InitGOFLAGS initializes the goflags list from $GOFLAGS.
+// If goflags is already initialized, it does nothing.
+func InitGOFLAGS() {
+	if goflags != nil { // already initialized
+		return
+	}
+
+	// Build list of all flags for all commands.
+	// If no command has that flag, then we report the problem.
+	// This catches typos while still letting users record flags in GOFLAGS
+	// that only apply to a subset of go commands.
+	// Commands using CustomFlags can report their flag names
+	// by calling AddKnownFlag instead.
+	var walkFlags func(*Command)
+	walkFlags = func(cmd *Command) {
+		for _, sub := range cmd.Commands {
+			walkFlags(sub)
+		}
+		cmd.Flag.VisitAll(func(f *flag.Flag) {
+			knownFlag[f.Name] = true
+		})
+	}
+	walkFlags(Go)
+
+	// Ignore bad flag in go env and go bug, because
+	// they are what people reach for when debugging
+	// a problem, and maybe they're debugging GOFLAGS.
+	// (Both will show the GOFLAGS setting if let succeed.)
+	hideErrors := cfg.CmdName == "env" || cfg.CmdName == "bug"
+
+	goflags = strings.Fields(os.Getenv("GOFLAGS"))
+	if goflags == nil {
+		goflags = []string{} // avoid work on later InitGOFLAGS call
+	}
+
+	// Each of the words returned by strings.Fields must be its own flag.
+	// To set flag arguments use -x=value instead of -x value.
+	// For boolean flags, -x is fine instead of -x=true.
+	for _, f := range goflags {
+		// Check that every flag looks like -x --x -x=value or --x=value.
+		if !strings.HasPrefix(f, "-") || f == "-" || f == "--" || strings.HasPrefix(f, "---") || strings.HasPrefix(f, "-=") || strings.HasPrefix(f, "--=") {
+			if hideErrors {
+				continue
+			}
+			Fatalf("go: parsing $GOFLAGS: non-flag %q", f)
+		}
+
+		name := f[1:]
+		if name[0] == '-' {
+			name = name[1:]
+		}
+		if i := strings.Index(name, "="); i >= 0 {
+			name = name[:i]
+		}
+		if !knownFlag[name] {
+			if hideErrors {
+				continue
+			}
+			Fatalf("go: parsing $GOFLAGS: unknown flag -%s", name)
+		}
+	}
+}
+
+// boolFlag is the optional interface for flag.Value known to the flag package.
+// (It is not clear why package flag does not export this interface.)
+type boolFlag interface {
+	flag.Value
+	IsBoolFlag() bool
+}
+
+// SetFromGOFLAGS sets the flags in the given flag set using settings in $GOFLAGS.
+func SetFromGOFLAGS(flags flag.FlagSet) {
+	InitGOFLAGS()
+
+	// This loop is similar to flag.Parse except that it ignores
+	// unknown flags found in goflags, so that setting, say, GOFLAGS=-ldflags=-w
+	// does not break commands that don't have a -ldflags.
+	// It also adjusts the output to be clear that the reported problem is from $GOFLAGS.
+	where := "$GOFLAGS"
+	if runtime.GOOS == "windows" {
+		where = "%GOFLAGS%"
+	}
+	for _, goflag := range goflags {
+		name, value, hasValue := goflag, "", false
+		if i := strings.Index(goflag, "="); i >= 0 {
+			name, value, hasValue = goflag[:i], goflag[i+1:], true
+		}
+		if strings.HasPrefix(name, "--") {
+			name = name[1:]
+		}
+		f := flags.Lookup(name[1:])
+		if f == nil {
+			continue
+		}
+		if fb, ok := f.Value.(boolFlag); ok && fb.IsBoolFlag() {
+			if hasValue {
+				if err := fb.Set(value); err != nil {
+					fmt.Fprintf(flags.Output(), "go: invalid boolean value %q for flag %s (from %s): %v\n", value, name, where, err)
+					flags.Usage()
+				}
+			} else {
+				if err := fb.Set("true"); err != nil {
+					fmt.Fprintf(flags.Output(), "go: invalid boolean flag %s (from %s): %v\n", name, where, err)
+					flags.Usage()
+				}
+			}
+		} else {
+			if !hasValue {
+				fmt.Fprintf(flags.Output(), "go: flag needs an argument: %s (from %s)\n", name, where)
+				flags.Usage()
+			}
+			if err := f.Value.Set(value); err != nil {
+				fmt.Fprintf(flags.Output(), "go: invalid value %q for flag %s (from %s): %v\n", value, name, where, err)
+				flags.Usage()
+			}
+		}
+	}
+}
diff --git a/vendor/cmd/go/internal/bug/bug.go b/vendor/cmd/go/internal/bug/bug.go
index 963da94..e701f6e 100644
--- a/vendor/cmd/go/internal/bug/bug.go
+++ b/vendor/cmd/go/internal/bug/bug.go
@@ -25,7 +25,7 @@
 
 var CmdBug = &base.Command{
 	Run:       runBug,
-	UsageLine: "bug",
+	UsageLine: "go bug",
 	Short:     "start a bug report",
 	Long: `
 Bug opens the default browser and starts a new bug report.
@@ -38,6 +38,9 @@
 }
 
 func runBug(cmd *base.Command, args []string) {
+	if len(args) > 0 {
+		base.Fatalf("go bug: bug takes no arguments")
+	}
 	var buf bytes.Buffer
 	buf.WriteString(bugHeader)
 	inspectGoVersion(&buf)
diff --git a/vendor/cmd/go/internal/cfg/cfg.go b/vendor/cmd/go/internal/cfg/cfg.go
index b66e54f..21f5e6c 100644
--- a/vendor/cmd/go/internal/cfg/cfg.go
+++ b/vendor/cmd/go/internal/cfg/cfg.go
@@ -21,8 +21,8 @@
 var (
 	BuildA                 bool   // -a flag
 	BuildBuildmode         string // -buildmode flag
-	BuildContext           = build.Default
-	BuildGetmode           string             // -getmode flag
+	BuildContext           = defaultContext()
+	BuildMod               string             // -mod flag
 	BuildI                 bool               // -i flag
 	BuildLinkshared        bool               // -linkshared flag
 	BuildMSan              bool               // -msan flag
@@ -44,6 +44,12 @@
 	DebugActiongraph string // -debug-actiongraph flag (undocumented, unstable)
 )
 
+func defaultContext() build.Context {
+	ctxt := build.Default
+	ctxt.JoinPath = filepath.Join // back door to say "do not use go command"
+	return ctxt
+}
+
 func init() {
 	BuildToolchainCompiler = func() string { return "missing-compiler" }
 	BuildToolchainLinker = func() string { return "missing-linker" }
diff --git a/vendor/cmd/go/internal/clean/clean.go b/vendor/cmd/go/internal/clean/clean.go
index 40cb324..d023592 100644
--- a/vendor/cmd/go/internal/clean/clean.go
+++ b/vendor/cmd/go/internal/clean/clean.go
@@ -18,11 +18,12 @@
 	"cmd/go/internal/cfg"
 	"cmd/go/internal/load"
 	"cmd/go/internal/modfetch"
+	"cmd/go/internal/modload"
 	"cmd/go/internal/work"
 )
 
 var CmdClean = &base.Command{
-	UsageLine: "clean [clean flags] [build flags] [packages]",
+	UsageLine: "go clean [clean flags] [build flags] [packages]",
 	Short:     "remove object files and cached files",
 	Long: `
 Clean removes object files from package source directories.
@@ -102,8 +103,13 @@
 }
 
 func runClean(cmd *base.Command, args []string) {
-	for _, pkg := range load.PackagesAndErrors(args) {
-		clean(pkg)
+	if len(args) == 0 && modload.Failed() {
+		// Don't try to clean current directory,
+		// which will cause modload to base.Fatalf.
+	} else {
+		for _, pkg := range load.PackagesAndErrors(args) {
+			clean(pkg)
+		}
 	}
 
 	if cleanCache {
@@ -147,10 +153,10 @@
 	}
 
 	if cleanModcache {
-		if modfetch.SrcMod == "" {
+		if modfetch.PkgMod == "" {
 			base.Fatalf("go clean -modcache: no module cache")
 		}
-		if err := removeAll(modfetch.SrcMod); err != nil {
+		if err := removeAll(modfetch.PkgMod); err != nil {
 			base.Errorf("go clean -modcache: %v", err)
 		}
 	}
diff --git a/vendor/cmd/go/internal/cmdflag/flag.go b/vendor/cmd/go/internal/cmdflag/flag.go
index 7ab3022..b2a67e6 100644
--- a/vendor/cmd/go/internal/cmdflag/flag.go
+++ b/vendor/cmd/go/internal/cmdflag/flag.go
@@ -69,6 +69,14 @@
 	os.Exit(2)
 }
 
+// AddKnownFlags registers the flags in defns with base.AddKnownFlag.
+func AddKnownFlags(cmd string, defns []*Defn) {
+	for _, f := range defns {
+		base.AddKnownFlag(f.Name)
+		base.AddKnownFlag(cmd + "." + f.Name)
+	}
+}
+
 // Parse sees if argument i is present in the definitions and if so,
 // returns its definition, value, and whether it consumed an extra word.
 // If the flag begins (cmd+".") it is ignored for the purpose of this function.
@@ -121,3 +129,31 @@
 	f = nil
 	return
 }
+
+// FindGOFLAGS extracts and returns the flags matching defns from GOFLAGS.
+// Ideally the caller would mention that the flags were from GOFLAGS
+// when reporting errors, but that's too hard for now.
+func FindGOFLAGS(defns []*Defn) []string {
+	var flags []string
+	for _, flag := range base.GOFLAGS() {
+		// Flags returned by base.GOFLAGS are well-formed, one of:
+		//	-x
+		//	--x
+		//	-x=value
+		//	--x=value
+		if strings.HasPrefix(flag, "--") {
+			flag = flag[1:]
+		}
+		name := flag[1:]
+		if i := strings.Index(name, "="); i >= 0 {
+			name = name[:i]
+		}
+		for _, f := range defns {
+			if name == f.Name {
+				flags = append(flags, flag)
+				break
+			}
+		}
+	}
+	return flags
+}
diff --git a/vendor/cmd/go/internal/doc/doc.go b/vendor/cmd/go/internal/doc/doc.go
index d73dd9a..4e7dca0 100644
--- a/vendor/cmd/go/internal/doc/doc.go
+++ b/vendor/cmd/go/internal/doc/doc.go
@@ -12,7 +12,7 @@
 
 var CmdDoc = &base.Command{
 	Run:         runDoc,
-	UsageLine:   "doc [-u] [-c] [package|[package.]symbol[.methodOrField]]",
+	UsageLine:   "go doc [-u] [-c] [package|[package.]symbol[.methodOrField]]",
 	CustomFlags: true,
 	Short:       "show documentation for package or symbol",
 	Long: `
diff --git a/vendor/cmd/go/internal/envcmd/env.go b/vendor/cmd/go/internal/envcmd/env.go
index 44fd18a..afadbad 100644
--- a/vendor/cmd/go/internal/envcmd/env.go
+++ b/vendor/cmd/go/internal/envcmd/env.go
@@ -22,7 +22,7 @@
 )
 
 var CmdEnv = &base.Command{
-	UsageLine: "env [-json] [var ...]",
+	UsageLine: "go env [-json] [var ...]",
 	Short:     "print Go environment information",
 	Long: `
 Env prints Go environment information.
@@ -54,6 +54,7 @@
 		{Name: "GOBIN", Value: cfg.GOBIN},
 		{Name: "GOCACHE", Value: cache.DefaultDir()},
 		{Name: "GOEXE", Value: cfg.ExeSuffix},
+		{Name: "GOFLAGS", Value: os.Getenv("GOFLAGS")},
 		{Name: "GOHOSTARCH", Value: runtime.GOARCH},
 		{Name: "GOHOSTOS", Value: runtime.GOOS},
 		{Name: "GOOS", Value: cfg.Goos},
diff --git a/vendor/cmd/go/internal/fix/fix.go b/vendor/cmd/go/internal/fix/fix.go
index 1f51d77..aab1641 100644
--- a/vendor/cmd/go/internal/fix/fix.go
+++ b/vendor/cmd/go/internal/fix/fix.go
@@ -17,7 +17,7 @@
 
 var CmdFix = &base.Command{
 	Run:       runFix,
-	UsageLine: "fix [packages]",
+	UsageLine: "go fix [packages]",
 	Short:     "update packages to use new APIs",
 	Long: `
 Fix runs the Go fix command on the packages named by the import paths.
diff --git a/vendor/cmd/go/internal/fmtcmd/fmt.go b/vendor/cmd/go/internal/fmtcmd/fmt.go
index ae158a7..0e5509e 100644
--- a/vendor/cmd/go/internal/fmtcmd/fmt.go
+++ b/vendor/cmd/go/internal/fmtcmd/fmt.go
@@ -26,7 +26,7 @@
 
 var CmdFmt = &base.Command{
 	Run:       runFmt,
-	UsageLine: "fmt [-n] [-x] [packages]",
+	UsageLine: "go fmt [-n] [-x] [packages]",
 	Short:     "gofmt (reformat) package sources",
 	Long: `
 Fmt runs the command 'gofmt -l -w' on the packages named
diff --git a/vendor/cmd/go/internal/generate/generate.go b/vendor/cmd/go/internal/generate/generate.go
index 2afd84f..9482be9 100644
--- a/vendor/cmd/go/internal/generate/generate.go
+++ b/vendor/cmd/go/internal/generate/generate.go
@@ -27,7 +27,7 @@
 
 var CmdGenerate = &base.Command{
 	Run:       runGenerate,
-	UsageLine: "generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]",
+	UsageLine: "go generate [-run regexp] [-n] [-v] [-x] [build flags] [file.go... | packages]",
 	Short:     "generate Go files by processing source",
 	Long: `
 Generate runs commands described by directives within existing
diff --git a/vendor/cmd/go/internal/get/get.go b/vendor/cmd/go/internal/get/get.go
index 0789d5b..fd97c6d 100644
--- a/vendor/cmd/go/internal/get/get.go
+++ b/vendor/cmd/go/internal/get/get.go
@@ -23,7 +23,7 @@
 )
 
 var CmdGet = &base.Command{
-	UsageLine: "get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]",
+	UsageLine: "go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]",
 	Short:     "download and install packages and dependencies",
 	Long: `
 Get downloads the packages named by the import paths, along with their
diff --git a/vendor/cmd/go/internal/help/help.go b/vendor/cmd/go/internal/help/help.go
index 75dbc68..d5ab5c7 100644
--- a/vendor/cmd/go/internal/help/help.go
+++ b/vendor/cmd/go/internal/help/help.go
@@ -21,20 +21,8 @@
 
 // Help implements the 'help' command.
 func Help(args []string) {
-	if len(args) == 0 {
-		PrintUsage(os.Stdout)
-		// not exit 2: succeeded at 'go help'.
-		return
-	}
-	if len(args) != 1 {
-		fmt.Fprintf(os.Stderr, "usage: go help command\n\nToo many arguments given.\n")
-		os.Exit(2) // failed at 'go help'
-	}
-
-	arg := args[0]
-
 	// 'go help documentation' generates doc.go.
-	if arg == "documentation" {
+	if len(args) == 1 && args[0] == "documentation" {
 		fmt.Println("// Copyright 2011 The Go Authors. All rights reserved.")
 		fmt.Println("// Use of this source code is governed by a BSD-style")
 		fmt.Println("// license that can be found in the LICENSE file.")
@@ -43,34 +31,51 @@
 		fmt.Println("// Edit the documentation in other files and rerun mkalldocs.sh to generate this one.")
 		fmt.Println()
 		buf := new(bytes.Buffer)
-		PrintUsage(buf)
+		PrintUsage(buf, base.Go)
 		usage := &base.Command{Long: buf.String()}
 		cmds := []*base.Command{usage}
-		for _, cmd := range base.Commands {
+		for _, cmd := range base.Go.Commands {
 			if cmd.UsageLine == "gopath-get" {
 				// Avoid duplication of the "get" documentation.
 				continue
 			}
 			cmds = append(cmds, cmd)
+			cmds = append(cmds, cmd.Commands...)
 		}
 		tmpl(&commentWriter{W: os.Stdout}, documentationTemplate, cmds)
 		fmt.Println("package main")
 		return
 	}
 
-	for _, cmd := range base.Commands {
-		if cmd.Name() == arg {
-			tmpl(os.Stdout, helpTemplate, cmd)
-			// not exit 2: succeeded at 'go help cmd'.
-			return
+	cmd := base.Go
+Args:
+	for i, arg := range args {
+		for _, sub := range cmd.Commands {
+			if sub.Name() == arg {
+				cmd = sub
+				continue Args
+			}
 		}
+
+		// helpSuccess is the help command using as many args as possible that would succeed.
+		helpSuccess := "go help"
+		if i > 0 {
+			helpSuccess = " " + strings.Join(args[:i], " ")
+		}
+		fmt.Fprintf(os.Stderr, "go help %s: unknown help topic. Run '%s'.\n", strings.Join(args, " "), helpSuccess)
+		os.Exit(2) // failed at 'go help cmd'
 	}
 
-	fmt.Fprintf(os.Stderr, "Unknown help topic %#q. Run 'go help'.\n", arg)
-	os.Exit(2) // failed at 'go help cmd'
+	if len(cmd.Commands) > 0 {
+		PrintUsage(os.Stdout, cmd)
+	} else {
+		tmpl(os.Stdout, helpTemplate, cmd)
+	}
+	// not exit 2: succeeded at 'go help cmd'.
+	return
 }
 
-var usageTemplate = `Go is a tool for managing Go source code.
+var usageTemplate = `{{.Long | trim}}
 
 This is vgo, an experimental go command with support for package versioning.
 Even though you are invoking it as vgo, most of the messages printed will
@@ -78,37 +83,37 @@
 
 Usage:
 
-	go command [arguments]
+	{{.UsageLine}} <command> [arguments]
 
 The commands are:
-{{range .}}{{if .Runnable}}
+{{range .Commands}}{{if or (.Runnable) .Commands}}
 	{{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}}
 
-Use "go help [command]" for more information about a command.
-
+Use "go help{{with .LongName}} {{.}}{{end}} <command>" for more information about a command.
+{{if eq (.UsageLine) "go"}}
 Additional help topics:
-{{range .}}{{if not .Runnable}}
+{{range .Commands}}{{if and (not .Runnable) (not .Commands)}}
 	{{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}}
 
-Use "go help [topic]" for more information about that topic.
-
+Use "go help{{with .LongName}} {{.}}{{end}} <topic>" for more information about that topic.
+{{end}}
 `
 
-var helpTemplate = `{{if .Runnable}}usage: go {{.UsageLine}}
+var helpTemplate = `{{if .Runnable}}usage: {{.UsageLine}}
 
 {{end}}{{.Long | trim}}
 `
 
 var documentationTemplate = `{{range .}}{{if .Short}}{{.Short | capitalize}}
 
-{{end}}{{if .Runnable}}Usage:
+{{end}}{{if .Commands}}` + usageTemplate + `{{else}}{{if .Runnable}}Usage:
 
-	go {{.UsageLine}}
+	{{.UsageLine}}
 
 {{end}}{{.Long | trim}}
 
 
-{{end}}`
+{{end}}{{end}}`
 
 // commentWriter writes a Go comment to the underlying io.Writer,
 // using line comment form (//).
@@ -183,8 +188,8 @@
 	return string(unicode.ToTitle(r)) + s[n:]
 }
 
-func PrintUsage(w io.Writer) {
+func PrintUsage(w io.Writer, cmd *base.Command) {
 	bw := bufio.NewWriter(w)
-	tmpl(bw, usageTemplate, base.Commands)
+	tmpl(bw, usageTemplate, cmd)
 	bw.Flush()
 }
diff --git a/vendor/cmd/go/internal/help/helpdoc.go b/vendor/cmd/go/internal/help/helpdoc.go
index c6dfaad..aff4ce1 100644
--- a/vendor/cmd/go/internal/help/helpdoc.go
+++ b/vendor/cmd/go/internal/help/helpdoc.go
@@ -377,7 +377,7 @@
 GOPATH and Modules
 
 When using modules, GOPATH is no longer used for resolving imports.
-However, it is still used to store downloaded source code (in GOPATH/src/mod)
+However, it is still used to store downloaded source code (in GOPATH/pkg/mod)
 and compiled commands (in GOPATH/bin).
 
 Internal Directories
@@ -486,6 +486,11 @@
 	GOCACHE
 		The directory where the go command will store cached
 		information for reuse in future builds.
+	GOFLAGS
+		A space-separated list of -flag=value settings to apply
+		to go commands by default, when the given flag is known by
+		the current command. Flags listed on the command-line
+		are applied after this list and therefore override it.
 	GOOS
 		The operating system for which to compile code.
 		Examples are linux, darwin, windows, netbsd.
@@ -501,10 +506,6 @@
 	GOTMPDIR
 		The directory where the go command will write
 		temporary source files, packages, and binaries.
-	GOTOOLDIR
-		The directory where the go tools (compile, cover, doc, etc...)
-		are installed. This is printed by go env, but setting the
-		environment variable has no effect.
 
 Environment variables for use with cgo:
 
@@ -573,6 +574,20 @@
 		Defined by Git. A colon-separated list of schemes that are allowed to be used
 		with git fetch/clone. If set, any scheme not explicitly mentioned will be
 		considered insecure by 'go get'.
+
+Additional information available from 'go env' but not read from the environment:
+
+	GOEXE
+		The executable file name suffix (".exe" on Windows, "" on other systems).
+	GOHOSTARCH
+		The architecture (GOARCH) of the Go toolchain binaries.
+	GOHOSTOS
+		The operating system (GOOS) of the Go toolchain binaries.
+	GOMOD
+		The absolute path to the go.mod of the main module,
+		or the empty string if not using modules.
+	GOTOOLDIR
+		The directory where the go tools (compile, cover, doc, etc...) are installed.
 	`,
 }
 
diff --git a/vendor/cmd/go/internal/imports/tags.go b/vendor/cmd/go/internal/imports/tags.go
index ba0ca94..1c22a47 100644
--- a/vendor/cmd/go/internal/imports/tags.go
+++ b/vendor/cmd/go/internal/imports/tags.go
@@ -24,7 +24,6 @@
 	if cfg.BuildContext.CgoEnabled {
 		tags["cgo"] = true
 	}
-	// TODO: Should read these out of GOROOT source code?
 	for _, tag := range cfg.BuildContext.BuildTags {
 		tags[tag] = true
 	}
diff --git a/vendor/cmd/go/internal/list/list.go b/vendor/cmd/go/internal/list/list.go
index 9a5edd4..7809163 100644
--- a/vendor/cmd/go/internal/list/list.go
+++ b/vendor/cmd/go/internal/list/list.go
@@ -26,7 +26,7 @@
 var CmdList = &base.Command{
 	// Note: -f -json -m are listed explicitly because they are the most common list flags.
 	// Do not send CLs removing them because they're covered by [list flags].
-	UsageLine: "list [-f format] [-json] [-m] [list flags] [build flags] [packages]",
+	UsageLine: "go list [-f format] [-json] [-m] [list flags] [build flags] [packages]",
 	Short:     "list packages or modules",
 	Long: `
 List lists the named packages, one per line.
@@ -66,20 +66,21 @@
         Module        *Module // info about package's containing module, if any (can be nil)
 
         // Source files
-        GoFiles        []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
-        CgoFiles       []string // .go sources files that import "C"
-        IgnoredGoFiles []string // .go sources ignored due to build constraints
-        CFiles         []string // .c source files
-        CXXFiles       []string // .cc, .cxx and .cpp source files
-        MFiles         []string // .m source files
-        HFiles         []string // .h, .hh, .hpp and .hxx source files
-        FFiles         []string // .f, .F, .for and .f90 Fortran source files
-        SFiles         []string // .s source files
-        SwigFiles      []string // .swig files
-        SwigCXXFiles   []string // .swigcxx files
-        SysoFiles      []string // .syso object files to add to archive
-        TestGoFiles    []string // _test.go files in package
-        XTestGoFiles   []string // _test.go files outside package
+        GoFiles         []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
+        CgoFiles        []string // .go source files that import "C"
+        CompiledGoFiles []string // .go files presented to compiler (when using -compiled)
+        IgnoredGoFiles  []string // .go source files ignored due to build constraints
+        CFiles          []string // .c source files
+        CXXFiles        []string // .cc, .cxx and .cpp source files
+        MFiles          []string // .m source files
+        HFiles          []string // .h, .hh, .hpp and .hxx source files
+        FFiles          []string // .f, .F, .for and .f90 Fortran source files
+        SFiles          []string // .s source files
+        SwigFiles       []string // .swig files
+        SwigCXXFiles    []string // .swigcxx files
+        SysoFiles       []string // .syso object files to add to archive
+        TestGoFiles     []string // _test.go files in package
+        XTestGoFiles    []string // _test.go files outside package
 
         // Cgo directives
         CgoCFLAGS    []string // cgo: flags for C compiler
@@ -142,9 +143,10 @@
 The -json flag causes the package data to be printed in JSON format
 instead of using the template format.
 
-The -cgo flag causes list to set CgoFiles not to the original *.go files
-importing "C" but instead to the translated files generated by the cgo
-command.
+The -compiled flag causes list to set CompiledGoFiles to the Go source
+files presented to the compiler. Typically this means that it repeats
+the files listed in GoFiles and then also adds the Go code generated
+by processing CgoFiles and SwigFiles.
 
 The -deps flag causes list to iterate over not just the named packages
 but also all their dependencies. It visits them in a depth-first post-order
@@ -165,6 +167,9 @@
 The -export flag causes list to set the Export field to the name of a
 file containing up-to-date export information for the given package.
 
+The -find flag causes list to identify the named packages but not
+resolve their dependencies: the Imports and Deps lists will be empty.
+
 The -test flag causes list to report not only the named packages
 but also their test binaries (for packages with tests), to convey to
 source code analysis tools exactly how test binaries are constructed.
@@ -184,8 +189,8 @@
 
 By default, the lists GoFiles, CgoFiles, and so on hold names of files in Dir
 (that is, paths relative to Dir, not absolute paths).
-The extra entries added by the -cgo and -test flags are absolute paths
-referring to cached copies of generated Go source files.
+The generated files added when using the -compiled and -test flags
+are absolute paths referring to cached copies of generated Go source files.
 Although they are Go source files, the paths may not end in ".go".
 
 The -m flag causes list to list modules instead of packages.
@@ -203,6 +208,7 @@
         Main     bool         // is this the main module?
         Indirect bool         // is this module only an indirect dependency of main module?
         Dir      string       // directory holding files for this module, if any
+        GoMod    string       // path to go.mod file for this module, if any
         Error    *ModuleError // error loading module
     }
 
@@ -281,11 +287,12 @@
 }
 
 var (
-	listCgo      = CmdList.Flag.Bool("cgo", false, "")
+	listCompiled = CmdList.Flag.Bool("compiled", false, "")
 	listDeps     = CmdList.Flag.Bool("deps", false, "")
 	listE        = CmdList.Flag.Bool("e", false, "")
 	listExport   = CmdList.Flag.Bool("export", false, "")
 	listFmt      = CmdList.Flag.String("f", "", "")
+	listFind     = CmdList.Flag.Bool("find", false, "")
 	listJson     = CmdList.Flag.Bool("json", false, "")
 	listM        = CmdList.Flag.Bool("m", false, "")
 	listU        = CmdList.Flag.Bool("u", false, "")
@@ -352,8 +359,8 @@
 
 	if *listM {
 		// Module mode.
-		if *listCgo {
-			base.Fatalf("go list -cgo cannot be used with -m")
+		if *listCompiled {
+			base.Fatalf("go list -compiled cannot be used with -m")
 		}
 		if *listDeps {
 			// TODO(rsc): Could make this mean something with -m.
@@ -362,6 +369,9 @@
 		if *listExport {
 			base.Fatalf("go list -export cannot be used with -m")
 		}
+		if *listFind {
+			base.Fatalf("go list -find cannot be used with -m")
+		}
 		if *listTest {
 			base.Fatalf("go list -test cannot be used with -m")
 		}
@@ -394,6 +404,15 @@
 		base.Fatalf("go list -versions can only be used with -m")
 	}
 
+	// These pairings make no sense.
+	if *listFind && *listDeps {
+		base.Fatalf("go list -deps cannot be used with -find")
+	}
+	if *listFind && *listTest {
+		base.Fatalf("go list -test cannot be used with -find")
+	}
+
+	load.IgnoreImports = *listFind
 	var pkgs []*load.Package
 	if *listE {
 		pkgs = load.PackagesAndErrors(args)
@@ -404,8 +423,8 @@
 	if cache.Default() == nil {
 		// These flags return file names pointing into the build cache,
 		// so the build cache must exist.
-		if *listCgo {
-			base.Fatalf("go list -cgo requires build cache")
+		if *listCompiled {
+			base.Fatalf("go list -compiled requires build cache")
 		}
 		if *listExport {
 			base.Fatalf("go list -export requires build cache")
@@ -423,20 +442,27 @@
 				continue
 			}
 			if len(p.TestGoFiles)+len(p.XTestGoFiles) > 0 {
-				pmain, _, _, err := load.TestPackagesFor(p, nil)
+				pmain, ptest, pxtest, err := load.TestPackagesFor(p, nil)
 				if err != nil {
-					if !*listE {
-						base.Errorf("can't load test package: %s", err)
+					if *listE {
+						pkgs = append(pkgs, &load.Package{
+							PackagePublic: load.PackagePublic{
+								ImportPath: p.ImportPath + ".test",
+								Error:      &load.PackageError{Err: err.Error()},
+							},
+						})
 						continue
 					}
-					pmain = &load.Package{
-						PackagePublic: load.PackagePublic{
-							ImportPath: p.ImportPath + ".test",
-							Error:      &load.PackageError{Err: err.Error()},
-						},
-					}
+					base.Errorf("can't load test package: %s", err)
+					continue
 				}
 				pkgs = append(pkgs, pmain)
+				if ptest != nil {
+					pkgs = append(pkgs, ptest)
+				}
+				if pxtest != nil {
+					pkgs = append(pkgs, pxtest)
+				}
 
 				data := *pmain.Internal.TestmainGo
 				h := cache.NewHash("testmain")
@@ -471,12 +497,12 @@
 
 	// Do we need to run a build to gather information?
 	needStale := *listJson || strings.Contains(*listFmt, ".Stale")
-	if needStale || *listExport || *listCgo {
+	if needStale || *listExport || *listCompiled {
 		var b work.Builder
 		b.Init()
 		b.IsCmdList = true
 		b.NeedExport = *listExport
-		b.NeedCgoFiles = *listCgo
+		b.NeedCompiledGoFiles = *listCompiled
 		a := &work.Action{}
 		// TODO: Use pkgsFilter?
 		for _, p := range pkgs {
diff --git a/vendor/cmd/go/internal/load/pkg.go b/vendor/cmd/go/internal/load/pkg.go
index 50cd01f..f27fdc1 100644
--- a/vendor/cmd/go/internal/load/pkg.go
+++ b/vendor/cmd/go/internal/load/pkg.go
@@ -28,6 +28,9 @@
 )
 
 var (
+	// module initialization hook; never nil, no-op if module use is disabled
+	ModInit func()
+
 	// module hooks; nil if module use is disabled
 	ModBinDir            func() string                                                   // return effective bin directory
 	ModLookup            func(parentPath, path string) (dir, realPath string, err error) // lookup effective meaning of import
@@ -76,18 +79,19 @@
 	// Source files
 	// If you add to this list you MUST add to p.AllFiles (below) too.
 	// Otherwise file name security lists will not apply to any new additions.
-	GoFiles        []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
-	CgoFiles       []string `json:",omitempty"` // .go sources files that import "C"
-	IgnoredGoFiles []string `json:",omitempty"` // .go sources ignored due to build constraints
-	CFiles         []string `json:",omitempty"` // .c source files
-	CXXFiles       []string `json:",omitempty"` // .cc, .cpp and .cxx source files
-	MFiles         []string `json:",omitempty"` // .m source files
-	HFiles         []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files
-	FFiles         []string `json:",omitempty"` // .f, .F, .for and .f90 Fortran source files
-	SFiles         []string `json:",omitempty"` // .s source files
-	SwigFiles      []string `json:",omitempty"` // .swig files
-	SwigCXXFiles   []string `json:",omitempty"` // .swigcxx files
-	SysoFiles      []string `json:",omitempty"` // .syso system object files added to package
+	GoFiles         []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
+	CgoFiles        []string `json:",omitempty"` // .go source files that import "C"
+	CompiledGoFiles []string `json:",omitempty"` // .go output from running cgo on CgoFiles
+	IgnoredGoFiles  []string `json:",omitempty"` // .go source files ignored due to build constraints
+	CFiles          []string `json:",omitempty"` // .c source files
+	CXXFiles        []string `json:",omitempty"` // .cc, .cpp and .cxx source files
+	MFiles          []string `json:",omitempty"` // .m source files
+	HFiles          []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files
+	FFiles          []string `json:",omitempty"` // .f, .F, .for and .f90 Fortran source files
+	SFiles          []string `json:",omitempty"` // .s source files
+	SwigFiles       []string `json:",omitempty"` // .swig files
+	SwigCXXFiles    []string `json:",omitempty"` // .swigcxx files
+	SysoFiles       []string `json:",omitempty"` // .syso system object files added to package
 
 	// Cgo directives
 	CgoCFLAGS    []string `json:",omitempty"` // cgo: flags for C compiler
@@ -125,6 +129,7 @@
 	return str.StringList(
 		p.GoFiles,
 		p.CgoFiles,
+		// no p.CompiledGoFiles, because they are from GoFiles or generated by us
 		p.IgnoredGoFiles,
 		p.CFiles,
 		p.CXXFiles,
@@ -282,6 +287,7 @@
 	p.XTestImports = pp.XTestImports
 	if IgnoreImports {
 		p.Imports = nil
+		p.Internal.RawImports = nil
 		p.TestImports = nil
 		p.XTestImports = nil
 	}
@@ -312,7 +318,8 @@
 	return "package " + strings.Join(p.ImportStack, "\n\timports ") + ": " + p.Err
 }
 
-// An ImportStack is a stack of import paths.
+// An ImportStack is a stack of import paths, possibly with the suffix " (test)" appended.
+// TODO(bcmills): When the tree opens for 1.12, replace the suffixed string with a struct.
 type ImportStack []string
 
 func (s *ImportStack) Push(p string) {
@@ -428,7 +435,7 @@
 
 	if strings.HasPrefix(path, "mod/") {
 		// Paths beginning with "mod/" might accidentally
-		// look in the module cache directory tree in $GOPATH/src/mod/.
+		// look in the module cache directory tree in $GOPATH/pkg/mod/.
 		// This prefix is owned by the Go core for possible use in the
 		// standard library (since it does not begin with a domain name),
 		// so it's OK to disallow entirely.
@@ -961,23 +968,37 @@
 	if i > 0 {
 		i-- // rewind over slash in ".../internal"
 	}
-	parent := p.Dir[:i+len(p.Dir)-len(p.ImportPath)]
-	if str.HasFilePathPrefix(filepath.Clean(srcDir), filepath.Clean(parent)) {
-		return p
-	}
 
-	// Look for symlinks before reporting error.
-	srcDir = expandPath(srcDir)
-	parent = expandPath(parent)
-	if str.HasFilePathPrefix(filepath.Clean(srcDir), filepath.Clean(parent)) {
-		return p
+	var where string
+	if p.Module == nil {
+		parent := p.Dir[:i+len(p.Dir)-len(p.ImportPath)]
+
+		if str.HasFilePathPrefix(filepath.Clean(srcDir), filepath.Clean(parent)) {
+			return p
+		}
+
+		// Look for symlinks before reporting error.
+		srcDir = expandPath(srcDir)
+		parent = expandPath(parent)
+		if str.HasFilePathPrefix(filepath.Clean(srcDir), filepath.Clean(parent)) {
+			return p
+		}
+	} else {
+		// p is in a module, so make it available based on the import path instead
+		// of the file path (https://golang.org/issue/23970).
+		parent := p.ImportPath[:i]
+		importer := strings.TrimSuffix((*stk)[len(*stk)-2], " (test)")
+		if str.HasPathPrefix(importer, parent) {
+			return p
+		}
+		where = " in " + importer
 	}
 
 	// Internal is present, and srcDir is outside parent's tree. Not allowed.
 	perr := *p
 	perr.Error = &PackageError{
 		ImportStack: stk.Copy(),
-		Err:         "use of internal package " + p.ImportPath + " not allowed",
+		Err:         "use of internal package " + p.ImportPath + " not allowed" + where,
 	}
 	perr.Incomplete = true
 	return &perr
@@ -1014,6 +1035,29 @@
 		return p
 	}
 
+	if p.Standard && ModPackageModuleInfo != nil {
+		// Modules must not import vendor packages in the standard library,
+		// but the usual vendor visibility check will not catch them
+		// because the module loader presents them with an ImportPath starting
+		// with "golang_org/" instead of "vendor/".
+		importer := strings.TrimSuffix((*stk)[len(*stk)-2], " (test)")
+		if mod := ModPackageModuleInfo(importer); mod != nil {
+			dir := p.Dir
+			if relDir, err := filepath.Rel(p.Root, p.Dir); err == nil {
+				dir = relDir
+			}
+			if _, ok := FindVendor(filepath.ToSlash(dir)); ok {
+				perr := *p
+				perr.Error = &PackageError{
+					ImportStack: stk.Copy(),
+					Err:         "use of vendored package " + path + " not allowed",
+				}
+				perr.Incomplete = true
+				return &perr
+			}
+		}
+	}
+
 	if perr := disallowVendorVisibility(srcDir, p, stk); perr != p {
 		return perr
 	}
@@ -1713,8 +1757,12 @@
 	// This lets you run go test ./ioutil in package io and be
 	// referring to io/ioutil rather than a hypothetical import of
 	// "./ioutil".
-	if build.IsLocalImport(arg) {
-		bp, _ := cfg.BuildContext.ImportDir(filepath.Join(base.Cwd, arg), build.FindOnly)
+	if build.IsLocalImport(arg) || filepath.IsAbs(arg) {
+		dir := arg
+		if !filepath.IsAbs(arg) {
+			dir = filepath.Join(base.Cwd, arg)
+		}
+		bp, _ := cfg.BuildContext.ImportDir(dir, build.FindOnly)
 		if bp.ImportPath != "" && bp.ImportPath != "." {
 			arg = bp.ImportPath
 		}
@@ -1780,7 +1828,7 @@
 	if cmdlineMatchers == nil {
 		SetCmdlinePatterns(search.CleanImportPaths(args))
 	}
-	if cfg.ModulesEnabled {
+	if ModInit(); cfg.ModulesEnabled {
 		return ModImportPaths(args)
 	}
 	return search.ImportPaths(args)
@@ -1840,6 +1888,8 @@
 // (typically named on the command line). The target is named p.a for
 // package p or named after the first Go file for package main.
 func GoFilesPackage(gofiles []string) *Package {
+	ModInit()
+
 	// TODO: Remove this restriction.
 	for _, f := range gofiles {
 		if !strings.HasSuffix(f, ".go") {
diff --git a/vendor/cmd/go/internal/modcmd/edit.go b/vendor/cmd/go/internal/modcmd/edit.go
new file mode 100644
index 0000000..5fea3e4
--- /dev/null
+++ b/vendor/cmd/go/internal/modcmd/edit.go
@@ -0,0 +1,382 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// go mod edit
+
+package modcmd
+
+import (
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"path/filepath"
+	"strings"
+
+	"cmd/go/internal/base"
+	"cmd/go/internal/modfile"
+	"cmd/go/internal/modload"
+	"cmd/go/internal/module"
+)
+
+var cmdEdit = &base.Command{
+	UsageLine: "go mod edit [editing flags] [go.mod]",
+	Short:     "edit go.mod from tools or scripts",
+	Long: `
+Edit provides a command-line interface for editing go.mod,
+for use primarily by tools or scripts. It reads only go.mod;
+it does not look up information about the modules involved.
+By default, edit reads and writes the go.mod file of the main module,
+but a different target file can be specified after the editing flags.
+
+The editing flags specify a sequence of editing operations.
+
+The -fmt flag reformats the go.mod file without making other changes.
+This reformatting is also implied by any other modifications that use or
+rewrite the go.mod file. The only time this flag is needed is if no other
+flags are specified, as in 'go mod edit -fmt'.
+
+The -module flag changes the module's path (the go.mod file's module line).
+
+The -require=path@version and -droprequire=path flags
+add and drop a requirement on the given module path and version.
+Note that -require overrides any existing requirements on path.
+These flags are mainly for tools that understand the module graph.
+Users should prefer 'go get path@version' or 'go get path@none',
+which make other go.mod adjustments as needed to satisfy
+constraints imposed by other modules.
+
+The -exclude=path@version and -dropexclude=path@version flags
+add and drop an exclusion for the given module path and version.
+Note that -exclude=path@version is a no-op if that exclusion already exists.
+
+The -replace=old[@v]=new[@v] and -dropreplace=old[@v] flags
+add and drop a replacement of the given module path and version pair.
+If the @v in old@v is omitted, the replacement applies to all versions
+with the old module path. If the @v in new@v is omitted, the new path
+should be a local module root directory, not a module path.
+Note that -replace overrides any existing replacements for old[@v].
+
+The -require, -droprequire, -exclude, -dropexclude, -replace,
+and -dropreplace editing flags may be repeated, and the changes
+are applied in the order given.
+
+The -print flag prints the final go.mod in its text format instead of
+writing it back to go.mod.
+
+The -json flag prints the final go.mod file in JSON format instead of
+writing it back to go.mod. The JSON output corresponds to these Go types:
+
+	type Module struct {
+		Path string
+		Version string
+	}
+
+	type GoMod struct {
+		Module Module
+		Require []Require
+		Exclude []Module
+		Replace []Replace
+	}
+
+	type Require struct {
+		Path string
+		Version string
+		Indirect bool
+	}
+
+	type Replace struct {
+		Old Module
+		New Module
+	}
+
+Note that this only describes the go.mod file itself, not other modules
+referred to indirectly. For the full set of modules available to a build,
+use 'go list -m -json all'.
+
+For example, a tool can obtain the go.mod as a data structure by
+parsing the output of 'go mod edit -json' and can then make changes
+by invoking 'go mod edit' with -require, -exclude, and so on.
+	`,
+}
+
+var (
+	editFmt = cmdEdit.Flag.Bool("fmt", false, "")
+	// editGo     = cmdEdit.Flag.String("go", "", "")
+	editJSON   = cmdEdit.Flag.Bool("json", false, "")
+	editPrint  = cmdEdit.Flag.Bool("print", false, "")
+	editModule = cmdEdit.Flag.String("module", "", "")
+	edits      []func(*modfile.File) // edits specified in flags
+)
+
+type flagFunc func(string)
+
+func (f flagFunc) String() string     { return "" }
+func (f flagFunc) Set(s string) error { f(s); return nil }
+
+func init() {
+	cmdEdit.Run = runEdit // break init cycle
+
+	cmdEdit.Flag.Var(flagFunc(flagRequire), "require", "")
+	cmdEdit.Flag.Var(flagFunc(flagDropRequire), "droprequire", "")
+	cmdEdit.Flag.Var(flagFunc(flagExclude), "exclude", "")
+	cmdEdit.Flag.Var(flagFunc(flagDropReplace), "dropreplace", "")
+	cmdEdit.Flag.Var(flagFunc(flagReplace), "replace", "")
+	cmdEdit.Flag.Var(flagFunc(flagDropExclude), "dropexclude", "")
+
+	base.AddBuildFlagsNX(&cmdEdit.Flag)
+}
+
+func runEdit(cmd *base.Command, args []string) {
+	anyFlags :=
+		*editModule != "" ||
+			*editJSON ||
+			*editPrint ||
+			*editFmt ||
+			len(edits) > 0
+
+	if !anyFlags {
+		base.Fatalf("go mod edit: no flags specified (see 'go help mod edit').")
+	}
+
+	if *editJSON && *editPrint {
+		base.Fatalf("go mod edit: cannot use both -json and -print")
+	}
+
+	if len(args) > 1 {
+		base.Fatalf("go mod edit: too many arguments")
+	}
+	var gomod string
+	if len(args) == 1 {
+		gomod = args[0]
+	} else {
+		modload.MustInit()
+		gomod = filepath.Join(modload.ModRoot, "go.mod")
+	}
+
+	if *editModule != "" {
+		if err := module.CheckPath(*editModule); err != nil {
+			base.Fatalf("go mod: invalid -module: %v", err)
+		}
+	}
+
+	// TODO(rsc): Implement -go= once we start advertising it.
+
+	data, err := ioutil.ReadFile(gomod)
+	if err != nil {
+		base.Fatalf("go: %v", err)
+	}
+
+	modFile, err := modfile.Parse(gomod, data, nil)
+	if err != nil {
+		base.Fatalf("go: errors parsing %s:\n%s", base.ShortPath(gomod), err)
+	}
+
+	if *editModule != "" {
+		modFile.AddModuleStmt(modload.CmdModModule)
+	}
+
+	if len(edits) > 0 {
+		for _, edit := range edits {
+			edit(modFile)
+		}
+	}
+	modFile.SortBlocks()
+	modFile.Cleanup() // clean file after edits
+
+	if *editJSON {
+		editPrintJSON(modFile)
+		return
+	}
+
+	data, err = modFile.Format()
+	if err != nil {
+		base.Fatalf("go: %v", err)
+	}
+
+	if *editPrint {
+		os.Stdout.Write(data)
+		return
+	}
+
+	if err := ioutil.WriteFile(gomod, data, 0666); err != nil {
+		base.Fatalf("go: %v", err)
+	}
+}
+
+// parsePathVersion parses -flag=arg expecting arg to be path@version.
+func parsePathVersion(flag, arg string) (path, version string) {
+	i := strings.Index(arg, "@")
+	if i < 0 {
+		base.Fatalf("go mod: -%s=%s: need path@version", flag, arg)
+	}
+	path, version = strings.TrimSpace(arg[:i]), strings.TrimSpace(arg[i+1:])
+	if err := module.CheckPath(path); err != nil {
+		base.Fatalf("go mod: -%s=%s: invalid path: %v", flag, arg, err)
+	}
+
+	// We don't call modfile.CheckPathVersion, because that insists
+	// on versions being in semver form, but here we want to allow
+	// versions like "master" or "1234abcdef", which the go command will resolve
+	// the next time it runs (or during -fix).
+	// Even so, we need to make sure the version is a valid token.
+	if modfile.MustQuote(version) {
+		base.Fatalf("go mod: -%s=%s: invalid version %q", flag, arg, version)
+	}
+
+	return path, version
+}
+
+// parsePath parses -flag=arg expecting arg to be path (not path@version).
+func parsePath(flag, arg string) (path string) {
+	if strings.Contains(arg, "@") {
+		base.Fatalf("go mod: -%s=%s: need just path, not path@version", flag, arg)
+	}
+	path = arg
+	if err := module.CheckPath(path); err != nil {
+		base.Fatalf("go mod: -%s=%s: invalid path: %v", flag, arg, err)
+	}
+	return path
+}
+
+// parsePathVersionOptional parses path[@version], using adj to
+// describe any errors.
+func parsePathVersionOptional(adj, arg string, allowDirPath bool) (path, version string, err error) {
+	if i := strings.Index(arg, "@"); i < 0 {
+		path = arg
+	} else {
+		path, version = strings.TrimSpace(arg[:i]), strings.TrimSpace(arg[i+1:])
+	}
+	if err := module.CheckPath(path); err != nil {
+		if !allowDirPath || !modfile.IsDirectoryPath(path) {
+			return path, version, fmt.Errorf("invalid %s path: %v", adj, err)
+		}
+	}
+	if path != arg && modfile.MustQuote(version) {
+		return path, version, fmt.Errorf("invalid %s version: %q", adj, version)
+	}
+	return path, version, nil
+}
+
+// flagRequire implements the -require flag.
+func flagRequire(arg string) {
+	path, version := parsePathVersion("require", arg)
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.AddRequire(path, version); err != nil {
+			base.Fatalf("go mod: -require=%s: %v", arg, err)
+		}
+	})
+}
+
+// flagDropRequire implements the -droprequire flag.
+func flagDropRequire(arg string) {
+	path := parsePath("droprequire", arg)
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.DropRequire(path); err != nil {
+			base.Fatalf("go mod: -droprequire=%s: %v", arg, err)
+		}
+	})
+}
+
+// flagExclude implements the -exclude flag.
+func flagExclude(arg string) {
+	path, version := parsePathVersion("exclude", arg)
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.AddExclude(path, version); err != nil {
+			base.Fatalf("go mod: -exclude=%s: %v", arg, err)
+		}
+	})
+}
+
+// flagDropExclude implements the -dropexclude flag.
+func flagDropExclude(arg string) {
+	path, version := parsePathVersion("dropexclude", arg)
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.DropExclude(path, version); err != nil {
+			base.Fatalf("go mod: -dropexclude=%s: %v", arg, err)
+		}
+	})
+}
+
+// flagReplace implements the -replace flag.
+func flagReplace(arg string) {
+	var i int
+	if i = strings.Index(arg, "="); i < 0 {
+		base.Fatalf("go mod: -replace=%s: need old[@v]=new[@w] (missing =)", arg)
+	}
+	old, new := strings.TrimSpace(arg[:i]), strings.TrimSpace(arg[i+1:])
+	if strings.HasPrefix(new, ">") {
+		base.Fatalf("go mod: -replace=%s: separator between old and new is =, not =>", arg)
+	}
+	oldPath, oldVersion, err := parsePathVersionOptional("old", old, false)
+	if err != nil {
+		base.Fatalf("go mod: -replace=%s: %v", arg, err)
+	}
+	newPath, newVersion, err := parsePathVersionOptional("new", new, true)
+	if err != nil {
+		base.Fatalf("go mod: -replace=%s: %v", arg, err)
+	}
+	if newPath == new && !modfile.IsDirectoryPath(new) {
+		base.Fatalf("go mod: -replace=%s: unversioned new path must be local directory", arg)
+	}
+
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.AddReplace(oldPath, oldVersion, newPath, newVersion); err != nil {
+			base.Fatalf("go mod: -replace=%s: %v", arg, err)
+		}
+	})
+}
+
+// flagDropReplace implements the -dropreplace flag.
+func flagDropReplace(arg string) {
+	path, version, err := parsePathVersionOptional("old", arg, true)
+	if err != nil {
+		base.Fatalf("go mod: -dropreplace=%s: %v", arg, err)
+	}
+	edits = append(edits, func(f *modfile.File) {
+		if err := f.DropReplace(path, version); err != nil {
+			base.Fatalf("go mod: -dropreplace=%s: %v", arg, err)
+		}
+	})
+}
+
+// fileJSON is the -json output data structure.
+type fileJSON struct {
+	Module  module.Version
+	Require []requireJSON
+	Exclude []module.Version
+	Replace []replaceJSON
+}
+
+type requireJSON struct {
+	Path     string
+	Version  string `json:",omitempty"`
+	Indirect bool   `json:",omitempty"`
+}
+
+type replaceJSON struct {
+	Old module.Version
+	New module.Version
+}
+
+// editPrintJSON prints the -json output.
+func editPrintJSON(modFile *modfile.File) {
+	var f fileJSON
+	f.Module = modFile.Module.Mod
+	for _, r := range modFile.Require {
+		f.Require = append(f.Require, requireJSON{Path: r.Mod.Path, Version: r.Mod.Version, Indirect: r.Indirect})
+	}
+	for _, x := range modFile.Exclude {
+		f.Exclude = append(f.Exclude, x.Mod)
+	}
+	for _, r := range modFile.Replace {
+		f.Replace = append(f.Replace, replaceJSON{r.Old, r.New})
+	}
+	data, err := json.MarshalIndent(&f, "", "\t")
+	if err != nil {
+		base.Fatalf("go: internal error: %v", err)
+	}
+	data = append(data, '\n')
+	os.Stdout.Write(data)
+}
diff --git a/vendor/cmd/go/internal/modcmd/fix.go b/vendor/cmd/go/internal/modcmd/fix.go
new file mode 100644
index 0000000..bfb5145
--- /dev/null
+++ b/vendor/cmd/go/internal/modcmd/fix.go
@@ -0,0 +1,65 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// go mod fix
+
+package modcmd
+
+import (
+	"cmd/go/internal/base"
+	"cmd/go/internal/modload"
+)
+
+var cmdFix = &base.Command{
+	UsageLine: "go mod fix",
+	Short:     "make go.mod semantically consistent",
+	Long: `
+Fix updates go.mod to use canonical version identifiers and
+to be semantically consistent. For example, consider this go.mod file:
+
+	module M
+
+	require (
+		A v1
+		B v1.0.0
+		C v1.0.0
+		D v1.2.3
+		E dev
+	)
+
+	exclude D v1.2.3
+
+First, fix rewrites non-canonical version identifiers to semver form, so
+A's v1 becomes v1.0.0 and E's dev becomes the pseudo-version for the latest
+commit on the dev branch, perhaps v0.0.0-20180523231146-b3f5c0f6e5f1.
+
+Next, fix updates requirements to respect exclusions, so the requirement
+on the excluded D v1.2.3 is updated to use the next available version of D,
+perhaps D v1.2.4 or D v1.3.0.
+
+Finally, fix removes redundant or misleading requirements.
+For example, if A v1.0.0 itself requires B v1.2.0 and C v1.0.0, then go.mod's
+requirement of B v1.0.0 is misleading (superseded by A's need for v1.2.0),
+and its requirement of C v1.0.0 is redundant (implied by A's need for the
+same version), so both will be removed. If module M contains packages
+that directly import packages from B or C, then the requirements will be
+kept but updated to the actual versions being used.
+
+Although fix runs the fix-up operation in isolation, the fix-up also
+runs automatically any time a go command uses the module graph,
+to update go.mod to reflect reality. Because the module graph defines
+the meaning of import statements, any commands that load packages
+also use and therefore fix the module graph. For example,
+go build, go get, go install, go list, go test, go mod graph, go mod tidy,
+and other commands all effectively imply go mod fix.
+	`,
+	Run: runFix,
+}
+
+func runFix(cmd *base.Command, args []string) {
+	if len(args) != 0 {
+		base.Fatalf("go mod fix: fix takes no arguments")
+	}
+	modload.LoadBuildList() // writes go.mod
+}
diff --git a/vendor/cmd/go/internal/modcmd/graph.go b/vendor/cmd/go/internal/modcmd/graph.go
new file mode 100644
index 0000000..5825c6d
--- /dev/null
+++ b/vendor/cmd/go/internal/modcmd/graph.go
@@ -0,0 +1,73 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// go mod graph
+
+package modcmd
+
+import (
+	"bufio"
+	"os"
+	"sort"
+
+	"cmd/go/internal/base"
+	"cmd/go/internal/modload"
+	"cmd/go/internal/module"
+	"cmd/go/internal/par"
+)
+
+var cmdGraph = &base.Command{
+	UsageLine: "go mod graph",
+	Short:     "print module requirement graph",
+	Long: `
+Graph prints the module requirement graph (with replacements applied)
+in text form. Each line in the output has two space-separated fields: a module
+and one of its requirements. Each module is identified as a string of the form
+path@version, except for the main module, which has no @version suffix.
+	`,
+	Run: runGraph,
+}
+
+func runGraph(cmd *base.Command, args []string) {
+	if len(args) > 0 {
+		base.Fatalf("go mod graph: graph takes no arguments")
+	}
+	modload.LoadBuildList()
+
+	reqs := modload.MinReqs()
+	format := func(m module.Version) string {
+		if m.Version == "" {
+			return m.Path
+		}
+		return m.Path + "@" + m.Version
+	}
+
+	// Note: using par.Work only to manage work queue.
+	// No parallelism here, so no locking.
+	var out []string
+	var deps int // index in out where deps start
+	var work par.Work
+	work.Add(modload.Target)
+	work.Do(1, func(item interface{}) {
+		m := item.(module.Version)
+		list, _ := reqs.Required(m)
+		for _, r := range list {
+			work.Add(r)
+			out = append(out, format(m)+" "+format(r)+"\n")
+		}
+		if m == modload.Target {
+			deps = len(out)
+		}
+	})
+
+	sort.Slice(out[deps:], func(i, j int) bool {
+		return out[deps+i][0] < out[deps+j][0]
+	})
+
+	w := bufio.NewWriter(os.Stdout)
+	for _, line := range out {
+		w.WriteString(line)
+	}
+	w.Flush()
+}
diff --git a/vendor/cmd/go/internal/modcmd/init.go b/vendor/cmd/go/internal/modcmd/init.go
new file mode 100644
index 0000000..f510a46
--- /dev/null
+++ b/vendor/cmd/go/internal/modcmd/init.go
@@ -0,0 +1,41 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// go mod init
+
+package modcmd
+
+import (
+	"cmd/go/internal/base"
+	"cmd/go/internal/modload"
+	"os"
+)
+
+var cmdInit = &base.Command{
+	UsageLine: "go mod init [module]",
+	Short:     "initialize new module in current directory",
+	Long: `
+Init initializes and writes a new go.mod to the current directory,
+in effect creating a new module rooted at the current directory.
+The file go.mod must not already exist.
+If possible, init will guess the module path from import comments
+(see 'go help importpath') or from version control configuration.
+To override this guess, supply the module path as an argument.
+	`,
+	Run: runInit,
+}
+
+func runInit(cmd *base.Command, args []string) {
+	modload.CmdModInit = true
+	if len(args) > 1 {
+		base.Fatalf("go mod init: too many arguments")
+	}
+	if len(args) == 1 {
+		modload.CmdModModule = args[0]
+	}
+	if _, err := os.Stat("go.mod"); err == nil {
+		base.Fatalf("go mod init: go.mod already exists")
+	}
+	modload.InitMod() // does all the hard work
+}
diff --git a/vendor/cmd/go/internal/modcmd/mod.go b/vendor/cmd/go/internal/modcmd/mod.go
index d01f699..c1a0ddc 100644
--- a/vendor/cmd/go/internal/modcmd/mod.go
+++ b/vendor/cmd/go/internal/modcmd/mod.go
@@ -5,552 +5,26 @@
 // Package modcmd implements the ``go mod'' command.
 package modcmd
 
-import (
-	"bufio"
-	"encoding/json"
-	"fmt"
-	"os"
-	"sort"
-	"strings"
-
-	"cmd/go/internal/base"
-	"cmd/go/internal/modfetch"
-	"cmd/go/internal/modfile"
-	"cmd/go/internal/modload"
-	"cmd/go/internal/module"
-	"cmd/go/internal/par"
-)
+import "cmd/go/internal/base"
 
 var CmdMod = &base.Command{
-	UsageLine: "mod [-v] [maintenance flags]",
+	UsageLine: "go mod",
 	Short:     "module maintenance",
-	Long: `
-Mod performs module maintenance operations as specified by the
-following flags, which may be combined.
+	Long: `Go mod provides access to operations on modules.
 
-The -v flag enables additional output about operations performed.
-
-The first group of operations provide low-level editing operations
-for manipulating go.mod from the command line or in scripts or
-other tools. They read only go.mod itself; they do not look up any
-information about the modules involved.
-
-The -init flag initializes and writes a new go.mod to the current directory,
-in effect creating a new module rooted at the current directory.
-The file go.mod must not already exist.
-If possible, mod will guess the module path from import comments
-(see 'go help importpath') or from version control configuration.
-To override this guess, use the -module flag.
-(Without -init, mod applies to the current module.)
-
-The -module flag changes (or, with -init, sets) the module's path
-(the go.mod file's module line).
-
-The -require=path@version and -droprequire=path flags
-add and drop a requirement on the given module path and version.
-Note that -require overrides any existing requirements on path.
-These flags are mainly for tools that understand the module graph.
-Users should prefer 'go get path@version' or 'go get path@none',
-which make other go.mod adjustments as needed to satisfy
-constraints imposed by other modules.
-
-The -exclude=path@version and -dropexclude=path@version flags
-add and drop an exclusion for the given module path and version.
-Note that -exclude=path@version is a no-op if that exclusion already exists.
-
-The -replace=old@v=new@w and -dropreplace=old@v flags
-add and drop a replacement of the given module path and version pair.
-If the @v in old@v is omitted, the replacement applies to all versions
-with the old module path. If the @v in new@v is omitted, the
-new path should be a directory on the local system, not a module path.
-Note that -replace overrides any existing replacements for old@v.
-
-These editing flags (-require, -droprequire, -exclude, -dropexclude,
--replace, and -dropreplace) may be repeated.
-
-The -fmt flag reformats the go.mod file without making other changes.
-This reformatting is also implied by any other modifications that use or
-rewrite the go.mod file. The only time this flag is needed is if no other
-flags are specified, as in 'go mod -fmt'.
-
-The -graph flag prints the module requirement graph (with replacements applied)
-in text form. Each line in the output has two space-separated fields: a module
-and one of its requirements. Each module is identified as a string of the form
-path@version, except for the main module, which has no @version suffix.
-
-The -json flag prints the go.mod file in JSON format corresponding to these
-Go types:
-
-	type Module struct {
-		Path string
-		Version string
-	}
-
-	type GoMod struct {
-		Module Module
-		Require []Require
-		Exclude []Module
-		Replace []Replace
-	}
-	
-	type Require struct {
-		Path string
-		Version string
-		Indirect bool
-	}
-	
-	type Replace string {
-		Old Module
-		New Module
-	}
-
-Note that this only describes the go.mod file itself, not other modules
-referred to indirectly. For the full set of modules available to a build,
-use 'go list -m -json all'.
-
-The next group of operations provide higher-level editing and maintenance
-of a module, beyond the go.mod file.
-
-The -packages flag prints a list of packages in the module.
-It only identifies directories containing Go source code;
-it does not check that those directories contain code that builds.
-
-The -fix flag updates go.mod to use canonical version identifiers and
-to be semantically consistent. For example, consider this go.mod file:
-
-	module M
-
-	require (
-		A v1
-		B v1.0.0
-		C v1.0.0
-		D v1.2.3
-		E dev
-	)
-
-	exclude D v1.2.3
-
-First, -fix rewrites non-canonical version identifiers to semver form, so
-A's v1 becomes v1.0.0 and E's dev becomes the pseudo-version for the latest
-commit on the dev branch, perhaps v0.0.0-20180523231146-b3f5c0f6e5f1.
-
-Next, -fix updates requirements to respect exclusions, so the requirement
-on the excluded D v1.2.3 is updated to use the next available version of D,
-perhaps D v1.2.4 or D v1.3.0.
-
-Finally, -fix removes redundant or misleading requirements.
-For example, if A v1.0.0 itself requires B v1.2.0 and C v1.0.0,
-then go.mod's requirement of B v1.0.0 is misleading (superseded
-by B's need for v1.2.0), and its requirement of C v1.0.0 is redundant
-(implied by B's need for the same version), so both will be removed.
-
-Although -fix runs the fix-up operation in isolation, the fix-up also
-runs automatically any time a go command uses the module graph,
-to update go.mod to reflect reality. For example, the -sync, -vendor,
-and -verify flags all effectively imply -fix. And because the module
-graph defines the meaning of import statements, any commands
-that load packages—'go build', 'go test', 'go list', and so on—also
-effectively imply 'go mod -fix'.
-
-The -sync flag synchronizes go.mod with the source code in the module.
-It adds any missing modules necessary to build the current module's
-packages and dependencies, and it removes unused modules that
-don't provide any relevant packages. It also adds any missing entries
-to go.sum and removes any unnecessary ones.
-
-The -vendor flag resets the module's vendor directory to include all
-packages needed to build and test all the module's packages.
-It does not include any test code for the vendored packages.
-
-The -verify flag checks that the dependencies of the current module,
-which are stored in a local downloaded source cache, have not been
-modified since being downloaded. If all the modules are unmodified,
--verify prints "all modules verified." Otherwise it reports which
-modules have been changed and causes 'go mod' to exit with a
-non-zero status.
+Note that support for modules is built into all the go commands,
+not just 'go mod'. For example, day-to-day adding, removing, upgrading,
+and downgrading of dependencies should be done using 'go get'.
+See 'go help modules' for an overview of module functionality.
 	`,
-}
 
-var (
-	modV = CmdMod.Flag.Bool("v", false, "")
-
-	modFmt      = CmdMod.Flag.Bool("fmt", false, "")
-	modFix      = CmdMod.Flag.Bool("fix", false, "")
-	modGraph    = CmdMod.Flag.Bool("graph", false, "")
-	modJSON     = CmdMod.Flag.Bool("json", false, "")
-	modPackages = CmdMod.Flag.Bool("packages", false, "")
-	modSync     = CmdMod.Flag.Bool("sync", false, "")
-	modVendor   = CmdMod.Flag.Bool("vendor", false, "")
-	modVerify   = CmdMod.Flag.Bool("verify", false, "")
-
-	modEdits []func(*modfile.File) // edits specified in flags
-)
-
-type flagFunc func(string)
-
-func (f flagFunc) String() string     { return "" }
-func (f flagFunc) Set(s string) error { f(s); return nil }
-
-func init() {
-	CmdMod.Run = runMod // break init cycle
-
-	CmdMod.Flag.BoolVar(&modload.CmdModInit, "init", modload.CmdModInit, "")
-	CmdMod.Flag.StringVar(&modload.CmdModModule, "module", modload.CmdModModule, "")
-
-	CmdMod.Flag.Var(flagFunc(flagRequire), "require", "")
-	CmdMod.Flag.Var(flagFunc(flagDropRequire), "droprequire", "")
-	CmdMod.Flag.Var(flagFunc(flagExclude), "exclude", "")
-	CmdMod.Flag.Var(flagFunc(flagDropReplace), "dropreplace", "")
-	CmdMod.Flag.Var(flagFunc(flagReplace), "replace", "")
-	CmdMod.Flag.Var(flagFunc(flagDropExclude), "dropexclude", "")
-
-	base.AddBuildFlagsNX(&CmdMod.Flag)
-}
-
-func runMod(cmd *base.Command, args []string) {
-	if modload.Init(); !modload.Enabled() {
-		base.Fatalf("go mod: cannot use outside module; see 'go help modules'")
-	}
-	if len(args) != 0 {
-		base.Fatalf("go mod: mod takes no arguments")
-	}
-
-	anyFlags :=
-		modload.CmdModInit ||
-			modload.CmdModModule != "" ||
-			*modVendor ||
-			*modVerify ||
-			*modJSON ||
-			*modFmt ||
-			*modFix ||
-			*modGraph ||
-			*modPackages ||
-			*modSync ||
-			len(modEdits) > 0
-
-	if !anyFlags {
-		base.Fatalf("go mod: no flags specified (see 'go help mod').")
-	}
-
-	if modload.CmdModModule != "" {
-		if err := module.CheckPath(modload.CmdModModule); err != nil {
-			base.Fatalf("go mod: invalid -module: %v", err)
-		}
-	}
-
-	if modload.CmdModInit {
-		if _, err := os.Stat("go.mod"); err == nil {
-			base.Fatalf("go mod -init: go.mod already exists")
-		}
-	}
-	modload.InitMod()
-
-	// Syntactic edits.
-
-	modFile := modload.ModFile()
-	if modload.CmdModModule != "" {
-		modFile.AddModuleStmt(modload.CmdModModule)
-	}
-
-	if len(modEdits) > 0 {
-		for _, edit := range modEdits {
-			edit(modFile)
-		}
-	}
-	modFile.SortBlocks()
-	modload.WriteGoMod() // write back syntactic changes
-
-	// Semantic edits.
-
-	needBuildList := *modFix || *modGraph
-
-	if *modSync || *modVendor || needBuildList {
-		var pkgs []string
-		if *modSync || *modVendor {
-			pkgs = modload.LoadALL()
-		} else {
-			modload.LoadBuildList()
-		}
-		if *modSync {
-			// LoadALL already added missing modules.
-			// Remove unused modules.
-			used := map[module.Version]bool{modload.Target: true}
-			for _, pkg := range pkgs {
-				used[modload.PackageModule(pkg)] = true
-			}
-
-			inGoMod := make(map[string]bool)
-			for _, r := range modload.ModFile().Require {
-				inGoMod[r.Mod.Path] = true
-			}
-
-			var keep []module.Version
-			for _, m := range modload.BuildList() {
-				if used[m] {
-					keep = append(keep, m)
-				} else if *modV && inGoMod[m.Path] {
-					fmt.Fprintf(os.Stderr, "unused %s\n", m.Path)
-				}
-			}
-			modload.SetBuildList(keep)
-			modSyncGoSum() // updates memory copy; WriteGoMod on next line flushes it out
-		}
-		modload.WriteGoMod()
-		if *modVendor {
-			runVendor()
-		}
-	}
-
-	// Read-only queries, processed only after updating go.mod.
-
-	if *modJSON {
-		modPrintJSON()
-	}
-
-	if *modGraph {
-		modPrintGraph()
-	}
-
-	if *modPackages {
-		for _, pkg := range modload.TargetPackages() {
-			fmt.Printf("%s\n", pkg)
-		}
-	}
-
-	if *modVerify {
-		runVerify()
-	}
-}
-
-// parsePathVersion parses -flag=arg expecting arg to be path@version.
-func parsePathVersion(flag, arg string) (path, version string) {
-	i := strings.Index(arg, "@")
-	if i < 0 {
-		base.Fatalf("go mod: -%s=%s: need path@version", flag, arg)
-	}
-	path, version = strings.TrimSpace(arg[:i]), strings.TrimSpace(arg[i+1:])
-	if err := module.CheckPath(path); err != nil {
-		base.Fatalf("go mod: -%s=%s: invalid path: %v", flag, arg, err)
-	}
-
-	// We don't call modfile.CheckPathVersion, because that insists
-	// on versions being in semver form, but here we want to allow
-	// versions like "master" or "1234abcdef", which the go command will resolve
-	// the next time it runs (or during -fix).
-	// Even so, we need to make sure the version is a valid token.
-	if modfile.MustQuote(version) {
-		base.Fatalf("go mod: -%s=%s: invalid version %q", flag, arg, version)
-	}
-
-	return path, version
-}
-
-// parsePath parses -flag=arg expecting arg to be path (not path@version).
-func parsePath(flag, arg string) (path string) {
-	if strings.Contains(arg, "@") {
-		base.Fatalf("go mod: -%s=%s: need just path, not path@version", flag, arg)
-	}
-	path = arg
-	if err := module.CheckPath(path); err != nil {
-		base.Fatalf("go mod: -%s=%s: invalid path: %v", flag, arg, err)
-	}
-	return path
-}
-
-// flagRequire implements the -require flag.
-func flagRequire(arg string) {
-	path, version := parsePathVersion("require", arg)
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.AddRequire(path, version); err != nil {
-			base.Fatalf("go mod: -require=%s: %v", arg, err)
-		}
-	})
-}
-
-// flagDropRequire implements the -droprequire flag.
-func flagDropRequire(arg string) {
-	path := parsePath("droprequire", arg)
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.DropRequire(path); err != nil {
-			base.Fatalf("go mod: -droprequire=%s: %v", arg, err)
-		}
-	})
-}
-
-// flagExclude implements the -exclude flag.
-func flagExclude(arg string) {
-	path, version := parsePathVersion("exclude", arg)
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.AddExclude(path, version); err != nil {
-			base.Fatalf("go mod: -exclude=%s: %v", arg, err)
-		}
-	})
-}
-
-// flagDropExclude implements the -dropexclude flag.
-func flagDropExclude(arg string) {
-	path, version := parsePathVersion("dropexclude", arg)
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.DropExclude(path, version); err != nil {
-			base.Fatalf("go mod: -dropexclude=%s: %v", arg, err)
-		}
-	})
-}
-
-// flagReplace implements the -replace flag.
-func flagReplace(arg string) {
-	var i int
-	if i = strings.Index(arg, "="); i < 0 {
-		base.Fatalf("go mod: -replace=%s: need old@v=new[@v] (missing =)", arg)
-	}
-	old, new := strings.TrimSpace(arg[:i]), strings.TrimSpace(arg[i+1:])
-	if strings.HasPrefix(new, ">") {
-		base.Fatalf("go mod: -replace=%s: separator between old and new is =, not =>", arg)
-	}
-	var oldPath, oldVersion string
-	if i = strings.Index(old, "@"); i < 0 {
-		oldPath = old
-	} else {
-		oldPath, oldVersion = strings.TrimSpace(old[:i]), strings.TrimSpace(old[i+1:])
-	}
-	if err := module.CheckPath(oldPath); err != nil {
-		base.Fatalf("go mod: -replace=%s: invalid old path: %v", arg, err)
-	}
-	if oldPath != old && modfile.MustQuote(oldVersion) {
-		base.Fatalf("go mod: -replace=%s: invalid old version %q", arg, oldVersion)
-	}
-	var newPath, newVersion string
-	if i = strings.Index(new, "@"); i >= 0 {
-		newPath, newVersion = strings.TrimSpace(new[:i]), strings.TrimSpace(new[i+1:])
-		if err := module.CheckPath(newPath); err != nil {
-			base.Fatalf("go mod: -replace=%s: invalid new path: %v", arg, err)
-		}
-		if modfile.MustQuote(newVersion) {
-			base.Fatalf("go mod: -replace=%s: invalid new version %q", arg, newVersion)
-		}
-	} else {
-		if !modfile.IsDirectoryPath(new) {
-			base.Fatalf("go mod: -replace=%s: unversioned new path must be local directory", arg)
-		}
-		newPath = new
-	}
-
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.AddReplace(oldPath, oldVersion, newPath, newVersion); err != nil {
-			base.Fatalf("go mod: -replace=%s: %v", arg, err)
-		}
-	})
-}
-
-// flagDropReplace implements the -dropreplace flag.
-func flagDropReplace(arg string) {
-	path, version := parsePathVersion("dropreplace", arg)
-	modEdits = append(modEdits, func(f *modfile.File) {
-		if err := f.DropReplace(path, version); err != nil {
-			base.Fatalf("go mod: -dropreplace=%s: %v", arg, err)
-		}
-	})
-}
-
-// fileJSON is the -json output data structure.
-type fileJSON struct {
-	Module  module.Version
-	Require []requireJSON
-	Exclude []module.Version
-	Replace []replaceJSON
-}
-
-type requireJSON struct {
-	Path     string
-	Version  string `json:",omitempty"`
-	Indirect bool   `json:",omitempty"`
-}
-
-type replaceJSON struct {
-	Old module.Version
-	New module.Version
-}
-
-// modPrintJSON prints the -json output.
-func modPrintJSON() {
-	modFile := modload.ModFile()
-
-	var f fileJSON
-	f.Module = modFile.Module.Mod
-	for _, r := range modFile.Require {
-		f.Require = append(f.Require, requireJSON{Path: r.Mod.Path, Version: r.Mod.Version, Indirect: r.Indirect})
-	}
-	for _, x := range modFile.Exclude {
-		f.Exclude = append(f.Exclude, x.Mod)
-	}
-	for _, r := range modFile.Replace {
-		f.Replace = append(f.Replace, replaceJSON{r.Old, r.New})
-	}
-	data, err := json.MarshalIndent(&f, "", "\t")
-	if err != nil {
-		base.Fatalf("go mod -json: internal error: %v", err)
-	}
-	data = append(data, '\n')
-	os.Stdout.Write(data)
-}
-
-// modPrintGraph prints the -graph output.
-func modPrintGraph() {
-	reqs := modload.Reqs()
-
-	format := func(m module.Version) string {
-		if m.Version == "" {
-			return m.Path
-		}
-		return m.Path + "@" + m.Version
-	}
-
-	// Note: using par.Work only to manage work queue.
-	// No parallelism here, so no locking.
-	var out []string
-	var deps int // index in out where deps start
-	var work par.Work
-	work.Add(modload.Target)
-	work.Do(1, func(item interface{}) {
-		m := item.(module.Version)
-		list, _ := reqs.Required(m)
-		for _, r := range list {
-			work.Add(r)
-			out = append(out, format(m)+" "+format(r)+"\n")
-		}
-		if m == modload.Target {
-			deps = len(out)
-		}
-	})
-
-	sort.Slice(out[deps:], func(i, j int) bool {
-		return out[deps+i][0] < out[deps+j][0]
-	})
-
-	w := bufio.NewWriter(os.Stdout)
-	for _, line := range out {
-		w.WriteString(line)
-	}
-	w.Flush()
-}
-
-// modSyncGoSum resets the go.sum file content
-// to be exactly what's needed for the current go.mod.
-func modSyncGoSum() {
-	// Assuming go.sum already has at least enough from the successful load,
-	// we only have to tell modfetch what needs keeping.
-	reqs := modload.Reqs()
-	keep := make(map[module.Version]bool)
-	var walk func(module.Version)
-	walk = func(m module.Version) {
-		keep[m] = true
-		list, _ := reqs.Required(m)
-		for _, r := range list {
-			if !keep[r] {
-				walk(r)
-			}
-		}
-	}
-	walk(modload.Target)
-	modfetch.TrimGoSum(keep)
+	Commands: []*base.Command{
+		cmdEdit,
+		cmdFix,
+		cmdGraph,
+		cmdInit,
+		cmdTidy,
+		cmdVendor,
+		cmdVerify,
+	},
 }
diff --git a/vendor/cmd/go/internal/modcmd/tidy.go b/vendor/cmd/go/internal/modcmd/tidy.go
new file mode 100644
index 0000000..54f47e7
--- /dev/null
+++ b/vendor/cmd/go/internal/modcmd/tidy.go
@@ -0,0 +1,89 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// go mod tidy
+
+package modcmd
+
+import (
+	"fmt"
+	"os"
+
+	"cmd/go/internal/base"
+	"cmd/go/internal/cfg"
+	"cmd/go/internal/modfetch"
+	"cmd/go/internal/modload"
+	"cmd/go/internal/module"
+)
+
+var cmdTidy = &base.Command{
+	UsageLine: "go mod tidy [-v]",
+	Short:     "add missing and remove unused modules",
+	Long: `
+Tidy makes sure go.mod matches the source code in the module.
+It adds any missing modules necessary to build the current module's
+packages and dependencies, and it removes unused modules that
+don't provide any relevant packages. It also adds any missing entries
+to go.sum and removes any unnecessary ones.
+
+The -v flag causes tidy to print information about removed modules
+to standard error.
+	`,
+}
+
+func init() {
+	cmdTidy.Run = runTidy // break init cycle
+	cmdTidy.Flag.BoolVar(&cfg.BuildV, "v", false, "")
+}
+
+func runTidy(cmd *base.Command, args []string) {
+	if len(args) > 0 {
+		base.Fatalf("go mod tidy: no arguments allowed")
+	}
+
+	// LoadALL adds missing modules.
+	// Remove unused modules.
+	used := map[module.Version]bool{modload.Target: true}
+	for _, pkg := range modload.LoadALL() {
+		used[modload.PackageModule(pkg)] = true
+	}
+
+	inGoMod := make(map[string]bool)
+	for _, r := range modload.ModFile().Require {
+		inGoMod[r.Mod.Path] = true
+	}
+
+	var keep []module.Version
+	for _, m := range modload.BuildList() {
+		if used[m] {
+			keep = append(keep, m)
+		} else if cfg.BuildV && inGoMod[m.Path] {
+			fmt.Fprintf(os.Stderr, "unused %s\n", m.Path)
+		}
+	}
+	modload.SetBuildList(keep)
+	modTidyGoSum() // updates memory copy; WriteGoMod on next line flushes it out
+	modload.WriteGoMod()
+}
+
+// modTidyGoSum resets the go.sum file content
+// to be exactly what's needed for the current go.mod.
+func modTidyGoSum() {
+	// Assuming go.sum already has at least enough from the successful load,
+	// we only have to tell modfetch what needs keeping.
+	reqs := modload.Reqs()
+	keep := make(map[module.Version]bool)
+	var walk func(module.Version)
+	walk = func(m module.Version) {
+		keep[m] = true
+		list, _ := reqs.Required(m)
+		for _, r := range list {
+			if !keep[r] {
+				walk(r)
+			}
+		}
+	}
+	walk(modload.Target)
+	modfetch.TrimGoSum(keep)
+}
diff --git a/vendor/cmd/go/internal/modcmd/vendor.go b/vendor/cmd/go/internal/modcmd/vendor.go
index 078c44f..62e7458 100644
--- a/vendor/cmd/go/internal/modcmd/vendor.go
+++ b/vendor/cmd/go/internal/modcmd/vendor.go
@@ -14,11 +14,33 @@
 	"strings"
 
 	"cmd/go/internal/base"
+	"cmd/go/internal/cfg"
 	"cmd/go/internal/modload"
 	"cmd/go/internal/module"
 )
 
-func runVendor() {
+var cmdVendor = &base.Command{
+	UsageLine: "go mod vendor [-v]",
+	Short:     "make vendored copy of dependencies",
+	Long: `
+Vendor resets the main module's vendor directory to include all packages
+needed to build and test all the main module's packages.
+It does not include test code for vendored packages.
+
+The -v flag causes vendor to print the names of vendored
+modules and packages to standard error.
+	`,
+	Run: runVendor,
+}
+
+func init() {
+	cmdVendor.Flag.BoolVar(&cfg.BuildV, "v", false, "")
+}
+
+func runVendor(cmd *base.Command, args []string) {
+	if len(args) != 0 {
+		base.Fatalf("go mod vendor: vendor takes no arguments")
+	}
 	pkgs := modload.LoadVendor()
 
 	vdir := filepath.Join(modload.ModRoot, "vendor")
@@ -46,12 +68,12 @@
 				}
 			}
 			fmt.Fprintf(&buf, "# %s %s%s\n", m.Path, m.Version, repl)
-			if *modV {
+			if cfg.BuildV {
 				fmt.Fprintf(os.Stderr, "# %s %s%s\n", m.Path, m.Version, repl)
 			}
 			for _, pkg := range pkgs {
 				fmt.Fprintf(&buf, "%s\n", pkg)
-				if *modV {
+				if cfg.BuildV {
 					fmt.Fprintf(os.Stderr, "%s\n", pkg)
 				}
 				vendorPkg(vdir, pkg)
diff --git a/vendor/cmd/go/internal/modcmd/verify.go b/vendor/cmd/go/internal/modcmd/verify.go
index 9b8d73f..381c18d 100644
--- a/vendor/cmd/go/internal/modcmd/verify.go
+++ b/vendor/cmd/go/internal/modcmd/verify.go
@@ -17,7 +17,25 @@
 	"cmd/go/internal/module"
 )
 
-func runVerify() {
+var cmdVerify = &base.Command{
+	UsageLine: "go mod verify",
+	Short:     "verify dependencies have expected content",
+	Long: `
+Verify checks that the dependencies of the current module,
+which are stored in a local downloaded source cache, have not been
+modified since being downloaded. If all the modules are unmodified,
+verify prints "all modules verified." Otherwise it reports which
+modules have been changed and causes 'go mod' to exit with a
+non-zero status.
+	`,
+	Run: runVerify,
+}
+
+func runVerify(cmd *base.Command, args []string) {
+	if len(args) != 0 {
+		// NOTE(rsc): Could take a module pattern.
+		base.Fatalf("go mod verify: verify takes no arguments")
+	}
 	ok := true
 	for _, mod := range modload.LoadBuildList()[1:] {
 		ok = verifyMod(mod) && ok
diff --git a/vendor/cmd/go/internal/modconv/convert_test.go b/vendor/cmd/go/internal/modconv/convert_test.go
index 72baa7e..f430380 100644
--- a/vendor/cmd/go/internal/modconv/convert_test.go
+++ b/vendor/cmd/go/internal/modconv/convert_test.go
@@ -39,7 +39,7 @@
 		log.Fatal(err)
 	}
 	defer os.RemoveAll(dir)
-	modfetch.SrcMod = filepath.Join(dir, "src/mod")
+	modfetch.PkgMod = filepath.Join(dir, "pkg/mod")
 	codehost.WorkRoot = filepath.Join(dir, "codework")
 
 	return m.Run()
diff --git a/vendor/cmd/go/internal/modfetch/cache.go b/vendor/cmd/go/internal/modfetch/cache.go
index d3cf8f3..b801f64 100644
--- a/vendor/cmd/go/internal/modfetch/cache.go
+++ b/vendor/cmd/go/internal/modfetch/cache.go
@@ -22,17 +22,17 @@
 
 var QuietLookup bool // do not print about lookups
 
-var SrcMod string // $GOPATH/src/mod; set by package modload
+var PkgMod string // $GOPATH/pkg/mod; set by package modload
 
 func cacheDir(path string) (string, error) {
-	if SrcMod == "" {
-		return "", fmt.Errorf("internal error: modfetch.SrcMod not set")
+	if PkgMod == "" {
+		return "", fmt.Errorf("internal error: modfetch.PkgMod not set")
 	}
 	enc, err := module.EncodePath(path)
 	if err != nil {
 		return "", err
 	}
-	return filepath.Join(SrcMod, "cache/download", enc, "/@v"), nil
+	return filepath.Join(PkgMod, "cache/download", enc, "/@v"), nil
 }
 
 func CachePath(m module.Version, suffix string) (string, error) {
@@ -46,12 +46,16 @@
 	if module.CanonicalVersion(m.Version) != m.Version {
 		return "", fmt.Errorf("non-canonical module version %q", m.Version)
 	}
-	return filepath.Join(dir, m.Version+"."+suffix), nil
+	encVer, err := module.EncodeVersion(m.Version)
+	if err != nil {
+		return "", err
+	}
+	return filepath.Join(dir, encVer+"."+suffix), nil
 }
 
 func DownloadDir(m module.Version) (string, error) {
-	if SrcMod == "" {
-		return "", fmt.Errorf("internal error: modfetch.SrcMod not set")
+	if PkgMod == "" {
+		return "", fmt.Errorf("internal error: modfetch.PkgMod not set")
 	}
 	enc, err := module.EncodePath(m.Path)
 	if err != nil {
@@ -63,7 +67,11 @@
 	if module.CanonicalVersion(m.Version) != m.Version {
 		return "", fmt.Errorf("non-canonical module version %q", m.Version)
 	}
-	return filepath.Join(SrcMod, enc+"@"+m.Version), nil
+	encVer, err := module.EncodeVersion(m.Version)
+	if err != nil {
+		return "", err
+	}
+	return filepath.Join(PkgMod, enc+"@"+encVer), nil
 }
 
 // A cachingRepo is a cache around an underlying Repo,
@@ -279,7 +287,7 @@
 // just to find out about a commit we already know about
 // (and have cached under its pseudo-version).
 func readDiskStatByHash(path, rev string) (file string, info *RevInfo, err error) {
-	if SrcMod == "" {
+	if PkgMod == "" {
 		// Do not download to current directory.
 		return "", nil, errNotCached
 	}
diff --git a/vendor/cmd/go/internal/modfetch/codehost/codehost.go b/vendor/cmd/go/internal/modfetch/codehost/codehost.go
index 9c07b96..4103ddc 100644
--- a/vendor/cmd/go/internal/modfetch/codehost/codehost.go
+++ b/vendor/cmd/go/internal/modfetch/codehost/codehost.go
@@ -201,6 +201,10 @@
 	return RunWithStdin(dir, nil, cmdline...)
 }
 
+// bashQuoter escapes characters that have special meaning in double-quoted strings in the bash shell.
+// See https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html.
+var bashQuoter = strings.NewReplacer(`"`, `\"`, `$`, `\$`, "`", "\\`", `\`, `\\`)
+
 func RunWithStdin(dir string, stdin io.Reader, cmdline ...interface{}) ([]byte, error) {
 	if dir != "" {
 		muIface, ok := dirLock.Load(dir)
@@ -214,11 +218,31 @@
 
 	cmd := str.StringList(cmdline...)
 	if cfg.BuildX {
-		var text string
+		text := new(strings.Builder)
 		if dir != "" {
-			text = "cd " + dir + "; "
+			text.WriteString("cd ")
+			text.WriteString(dir)
+			text.WriteString("; ")
 		}
-		text += strings.Join(cmd, " ")
+		for i, arg := range cmd {
+			if i > 0 {
+				text.WriteByte(' ')
+			}
+			switch {
+			case strings.ContainsAny(arg, "'"):
+				// Quote args that could be mistaken for quoted args.
+				text.WriteByte('"')
+				text.WriteString(bashQuoter.Replace(arg))
+				text.WriteByte('"')
+			case strings.ContainsAny(arg, "$`\\*?[\"\t\n\v\f\r \u0085\u00a0"):
+				// Quote args that contain special characters, glob patterns, or spaces.
+				text.WriteByte('\'')
+				text.WriteString(arg)
+				text.WriteByte('\'')
+			default:
+				text.WriteString(arg)
+			}
+		}
 		fmt.Fprintf(os.Stderr, "%s\n", text)
 		start := time.Now()
 		defer func() {
diff --git a/vendor/cmd/go/internal/modfetch/codehost/git.go b/vendor/cmd/go/internal/modfetch/codehost/git.go
index ca5fcfe..0f159bd 100644
--- a/vendor/cmd/go/internal/modfetch/codehost/git.go
+++ b/vendor/cmd/go/internal/modfetch/codehost/git.go
@@ -378,7 +378,7 @@
 // statLocal returns a RevInfo describing rev in the local git repository.
 // It uses version as info.Version.
 func (r *gitRepo) statLocal(version, rev string) (*RevInfo, error) {
-	out, err := Run(r.dir, "git", "log", "-n1", "--format=format:%H %ct %D", "--no-show-signature", rev)
+	out, err := Run(r.dir, "git", "-c", "log.showsignature=false", "log", "-n1", "--format=format:%H %ct %D", rev)
 	if err != nil {
 		return nil, fmt.Errorf("unknown revision %s", rev)
 	}
diff --git a/vendor/cmd/go/internal/modfetch/fetch.go b/vendor/cmd/go/internal/modfetch/fetch.go
index 110312b..b4944af 100644
--- a/vendor/cmd/go/internal/modfetch/fetch.go
+++ b/vendor/cmd/go/internal/modfetch/fetch.go
@@ -28,9 +28,9 @@
 // local download cache and returns the name of the directory
 // corresponding to the root of the module's file tree.
 func Download(mod module.Version) (dir string, err error) {
-	if SrcMod == "" {
+	if PkgMod == "" {
 		// Do not download to current directory.
-		return "", fmt.Errorf("missing modfetch.SrcMod")
+		return "", fmt.Errorf("missing modfetch.PkgMod")
 	}
 
 	// The par.Cache here avoids duplicate work but also
@@ -53,7 +53,7 @@
 			if _, err := os.Stat(zipfile); err == nil {
 				// Use it.
 				// This should only happen if the mod/cache directory is preinitialized
-				// or if src/mod/path was removed but not src/mod/cache/download.
+				// or if pkg/mod/path was removed but not pkg/mod/cache/download.
 				fmt.Fprintf(os.Stderr, "go: extracting %s %s\n", mod.Path, mod.Version)
 			} else {
 				if err := os.MkdirAll(filepath.Dir(zipfile), 0777); err != nil {
@@ -90,7 +90,6 @@
 	// Double-check zip file looks OK.
 	z, err := zip.OpenReader(tmpfile)
 	if err != nil {
-		z.Close()
 		return err
 	}
 	prefix := mod.Path + "@" + mod.Version
@@ -201,7 +200,7 @@
 
 // checkSum checks the given module's checksum.
 func checkSum(mod module.Version) {
-	if SrcMod == "" {
+	if PkgMod == "" {
 		// Do not use current directory.
 		return
 	}
@@ -265,7 +264,7 @@
 // Sum returns the checksum for the downloaded copy of the given module,
 // if present in the download cache.
 func Sum(mod module.Version) string {
-	if SrcMod == "" {
+	if PkgMod == "" {
 		// Do not use current directory.
 		return ""
 	}
diff --git a/vendor/cmd/go/internal/modfetch/proxy.go b/vendor/cmd/go/internal/modfetch/proxy.go
index ffd65d4..693eb18 100644
--- a/vendor/cmd/go/internal/modfetch/proxy.go
+++ b/vendor/cmd/go/internal/modfetch/proxy.go
@@ -25,11 +25,14 @@
 	Short:     "module proxy protocol",
 	Long: `
 The go command by default downloads modules from version control systems
-directly, just as 'go get' always has. If the GOPROXY environment variable
-is set to the URL of a module proxy, the go command will instead fetch
-all modules from that proxy. No matter the source of the modules, downloaded
-modules must match existing entries in go.sum (see 'go help modules' for
-discussion of verification).
+directly, just as 'go get' always has. The GOPROXY environment variable allows
+further control over the download source. If GOPROXY is unset, is the empty string,
+or is the string "direct", downloads use the default direct connection to version
+control systems. Setting GOPROXY to "off" disallows downloading modules from
+any source. Otherwise, GOPROXY is expected to be the URL of a module proxy,
+in which case the go command will fetch all modules from that proxy.
+No matter the source of the modules, downloaded modules must match existing
+entries in go.sum (see 'go help modules' for discussion of verification).
 
 A Go module proxy is any web server that can respond to GET requests for
 URLs of a specified form. The requests have no query parameters, so even
@@ -74,10 +77,10 @@
 
 Even when downloading directly from version control systems,
 the go command synthesizes explicit info, mod, and zip files
-and stores them in its local cache, $GOPATH/src/mod/cache/download,
+and stores them in its local cache, $GOPATH/pkg/mod/cache/download,
 the same as if it had downloaded them directly from a proxy.
 The cache layout is the same as the proxy URL space, so
-serving $GOPATH/src/mod/cache/download at (or copying it to)
+serving $GOPATH/pkg/mod/cache/download at (or copying it to)
 https://example.com/proxy would let other users access those
 cached module versions with GOPROXY=https://example.com/proxy.
 `,
@@ -163,7 +166,11 @@
 
 func (p *proxyRepo) Stat(rev string) (*RevInfo, error) {
 	var data []byte
-	err := webGetBytes(p.url+"/@v/"+pathEscape(rev)+".info", &data)
+	encRev, err := module.EncodeVersion(rev)
+	if err != nil {
+		return nil, err
+	}
+	err = webGetBytes(p.url+"/@v/"+pathEscape(encRev)+".info", &data)
 	if err != nil {
 		return nil, err
 	}
@@ -191,7 +198,11 @@
 
 func (p *proxyRepo) GoMod(version string) ([]byte, error) {
 	var data []byte
-	err := webGetBytes(p.url+"/@v/"+pathEscape(version)+".mod", &data)
+	encVer, err := module.EncodeVersion(version)
+	if err != nil {
+		return nil, err
+	}
+	err = webGetBytes(p.url+"/@v/"+pathEscape(encVer)+".mod", &data)
 	if err != nil {
 		return nil, err
 	}
@@ -200,7 +211,11 @@
 
 func (p *proxyRepo) Zip(version string, tmpdir string) (tmpfile string, err error) {
 	var body io.ReadCloser
-	err = webGetBody(p.url+"/@v/"+pathEscape(version)+".zip", &body)
+	encVer, err := module.EncodeVersion(version)
+	if err != nil {
+		return "", err
+	}
+	err = webGetBody(p.url+"/@v/"+pathEscape(encVer)+".zip", &body)
 	if err != nil {
 		return "", err
 	}
diff --git a/vendor/cmd/go/internal/modfetch/repo.go b/vendor/cmd/go/internal/modfetch/repo.go
index 905b16b..f6f47bb 100644
--- a/vendor/cmd/go/internal/modfetch/repo.go
+++ b/vendor/cmd/go/internal/modfetch/repo.go
@@ -203,10 +203,13 @@
 
 // lookup returns the module with the given module path.
 func lookup(path string) (r Repo, err error) {
-	if cfg.BuildGetmode != "" {
-		return nil, fmt.Errorf("module lookup disabled by -getmode=%s", cfg.BuildGetmode)
+	if cfg.BuildMod == "vendor" {
+		return nil, fmt.Errorf("module lookup disabled by -mod=%s", cfg.BuildMod)
 	}
-	if proxyURL != "" {
+	if proxyURL == "off" {
+		return nil, fmt.Errorf("module lookup disabled by GOPROXY=%s", proxyURL)
+	}
+	if proxyURL != "" && proxyURL != "direct" {
 		return lookupProxy(path)
 	}
 
@@ -241,8 +244,8 @@
 // the original "go get" would have used, at the specific repository revision
 // (typically a commit hash, but possibly also a source control tag).
 func ImportRepoRev(path, rev string) (Repo, *RevInfo, error) {
-	if cfg.BuildGetmode != "" {
-		return nil, nil, fmt.Errorf("repo version lookup disabled by -getmode=%s", cfg.BuildGetmode)
+	if cfg.BuildMod == "vendor" || cfg.BuildMod == "readonly" {
+		return nil, nil, fmt.Errorf("repo version lookup disabled by -mod=%s", cfg.BuildMod)
 	}
 
 	// Note: Because we are converting a code reference from a legacy
diff --git a/vendor/cmd/go/internal/modfile/read_test.go b/vendor/cmd/go/internal/modfile/read_test.go
index 254e549..8cb1a39 100644
--- a/vendor/cmd/go/internal/modfile/read_test.go
+++ b/vendor/cmd/go/internal/modfile/read_test.go
@@ -66,6 +66,21 @@
 	}
 }
 
+func TestParseLax(t *testing.T) {
+	badFile := []byte(`module m
+		surprise attack
+		x y (
+			z
+		)
+		exclude v1.2.3
+		replace <-!!!
+	`)
+	_, err := ParseLax("file", badFile, nil)
+	if err != nil {
+		t.Fatalf("ParseLax did not ignore irrelevant errors: %v", err)
+	}
+}
+
 // Test that when files in the testdata directory are parsed
 // and printed and parsed again, we get the same parse tree
 // both times.
diff --git a/vendor/cmd/go/internal/modfile/rule.go b/vendor/cmd/go/internal/modfile/rule.go
index bf6dd5a..f669575 100644
--- a/vendor/cmd/go/internal/modfile/rule.go
+++ b/vendor/cmd/go/internal/modfile/rule.go
@@ -9,6 +9,7 @@
 	"errors"
 	"fmt"
 	"path/filepath"
+	"regexp"
 	"sort"
 	"strconv"
 	"strings"
@@ -21,6 +22,7 @@
 // A File is the parsed, interpreted form of a go.mod file.
 type File struct {
 	Module  *Module
+	Go      *Go
 	Require []*Require
 	Exclude []*Exclude
 	Replace []*Replace
@@ -34,6 +36,12 @@
 	Syntax *Line
 }
 
+// A Go is the go statement.
+type Go struct {
+	Version string // "1.23"
+	Syntax  *Line
+}
+
 // A Require is a single require statement.
 type Require struct {
 	Mod      module.Version
@@ -87,7 +95,24 @@
 
 type VersionFixer func(path, version string) (string, error)
 
+// Parse parses the data, reported in errors as being from file,
+// into a File struct. It applies fix, if non-nil, to canonicalize all module versions found.
 func Parse(file string, data []byte, fix VersionFixer) (*File, error) {
+	return parseToFile(file, data, fix, true)
+}
+
+// ParseLax is like Parse but ignores unknown statements.
+// It is used when parsing go.mod files other than the main module,
+// under the theory that most statement types we add in the future will
+// only apply in the main module, like exclude and replace,
+// and so we get better gradual deployments if old go commands
+// simply ignore those statements when found in go.mod files
+// in dependencies.
+func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) {
+	return parseToFile(file, data, fix, false)
+}
+
+func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (*File, error) {
 	fs, err := parse(file, data)
 	if err != nil {
 		return nil, err
@@ -100,20 +125,24 @@
 	for _, x := range fs.Stmt {
 		switch x := x.(type) {
 		case *Line:
-			f.add(&errs, x, x.Token[0], x.Token[1:], fix)
+			f.add(&errs, x, x.Token[0], x.Token[1:], fix, strict)
 
 		case *LineBlock:
 			if len(x.Token) > 1 {
-				fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " "))
+				if strict {
+					fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " "))
+				}
 				continue
 			}
 			switch x.Token[0] {
 			default:
-				fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " "))
+				if strict {
+					fmt.Fprintf(&errs, "%s:%d: unknown block type: %s\n", file, x.Start.Line, strings.Join(x.Token, " "))
+				}
 				continue
 			case "module", "require", "exclude", "replace":
 				for _, l := range x.Line {
-					f.add(&errs, l, x.Token[0], l.Token, fix)
+					f.add(&errs, l, x.Token[0], l.Token, fix, strict)
 				}
 			}
 		}
@@ -125,15 +154,39 @@
 	return f, nil
 }
 
-func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, fix VersionFixer) {
-	// TODO: We should pass in a flag saying whether this module is a dependency.
-	// If so, we should ignore all unknown directives and not attempt to parse
-	// replace and exclude either. They don't matter, and it will work better for
-	// forward compatibility if we can depend on modules that have local changes.
+var goVersionRE = regexp.MustCompile(`([1-9][0-9]*)\.(0|[1-9][0-9]*)`)
+
+func (f *File) add(errs *bytes.Buffer, line *Line, verb string, args []string, fix VersionFixer, strict bool) {
+	// If strict is false, this module is a dependency.
+	// We ignore all unknown directives as well as main-module-only
+	// directives like replace and exclude. It will work better for
+	// forward compatibility if we can depend on modules that have unknown
+	// statements (presumed relevant only when acting as the main module)
+	// and simply ignore those statements.
+	if !strict {
+		switch verb {
+		case "module", "require", "go":
+			// want these even for dependency go.mods
+		default:
+			return
+		}
+	}
 
 	switch verb {
 	default:
 		fmt.Fprintf(errs, "%s:%d: unknown directive: %s\n", f.Syntax.Name, line.Start.Line, verb)
+
+	case "go":
+		if f.Go != nil {
+			fmt.Fprintf(errs, "%s:%d: repeated go statement\n", f.Syntax.Name, line.Start.Line)
+			return
+		}
+		if len(args) != 1 || !goVersionRE.MatchString(args[0]) {
+			fmt.Fprintf(errs, "%s:%d: usage: go 1.23\n", f.Syntax.Name, line.Start.Line)
+			return
+		}
+		f.Go = &Go{Syntax: line}
+		f.Go.Version = args[0]
 	case "module":
 		if f.Module != nil {
 			fmt.Fprintf(errs, "%s:%d: repeated module statement\n", f.Syntax.Name, line.Start.Line)
diff --git a/vendor/cmd/go/internal/modget/get.go b/vendor/cmd/go/internal/modget/get.go
index 1fd6970..e8b0857 100644
--- a/vendor/cmd/go/internal/modget/get.go
+++ b/vendor/cmd/go/internal/modget/get.go
@@ -29,13 +29,13 @@
 var CmdGet = &base.Command{
 	// Note: -d -m -u are listed explicitly because they are the most common get flags.
 	// Do not send CLs removing them because they're covered by [get flags].
-	UsageLine: "get [-d] [-m] [-u] [-v] [-insecure] [build flags] [packages]",
+	UsageLine: "go get [-d] [-m] [-u] [-v] [-insecure] [build flags] [packages]",
 	Short:     "add dependencies to current module and install them",
 	Long: `
 Get resolves and adds dependencies to the current development module
 and then builds and installs them.
 
-The first step is to resolve which dependencies to add. 
+The first step is to resolve which dependencies to add.
 
 For each named package or package pattern, get must decide which version of
 the corresponding module to use. By default, get chooses the latest tagged
@@ -177,13 +177,23 @@
 	CmdGet.Flag.Var(&getU, "u", "")
 }
 
-type Pkg struct {
-	Arg  string
-	Path string
-	Vers string
+// A task holds the state for processing a single get argument (path@vers).
+type task struct {
+	arg             string // original argument
+	index           int
+	path            string           // package path part of arg
+	forceModulePath bool             // path must be interpreted as a module path
+	vers            string           // version part of arg
+	m               module.Version   // module version indicated by argument
+	req             []module.Version // m's requirement list (not upgraded)
 }
 
 func runGet(cmd *base.Command, args []string) {
+	// -mod=readonly has no effect on "go get".
+	if cfg.BuildMod == "readonly" {
+		cfg.BuildMod = ""
+	}
+
 	switch getU {
 	case "", "patch", "true":
 		// ok
@@ -200,21 +210,16 @@
 		fmt.Fprintf(os.Stderr, "go get: -t flag is a no-op when using modules\n")
 	}
 
-	if cfg.BuildGetmode == "vendor" {
-		base.Fatalf("go get: disabled by -getmode=vendor")
+	if cfg.BuildMod == "vendor" {
+		base.Fatalf("go get: disabled by -mod=%s", cfg.BuildMod)
 	}
 
 	modload.LoadBuildList()
 
-	// A task holds the state for processing a single get argument (path@vers).
-	type task struct {
-		arg             string           // original argument
-		path            string           // package path part of arg
-		forceModulePath bool             // path must be interpreted as a module path
-		vers            string           // version part of arg
-		m               module.Version   // module version indicated by argument
-		req             []module.Version // m's requirement list (not upgraded)
-	}
+	// Do not allow any updating of go.mod until we've applied
+	// all the requested changes and checked that the result matches
+	// what was requested.
+	modload.DisallowWriteGoMod()
 
 	// Build task and install lists.
 	// The command-line arguments are of the form path@version
@@ -285,10 +290,6 @@
 			continue
 		}
 		if path == "all" {
-			if path != arg {
-				base.Errorf("go get %s: cannot use pattern %q with explicit version", arg, arg)
-			}
-
 			// TODO: If *getM, should this be the module pattern "all"?
 
 			// This is the package pattern "all" not the module pattern "all":
@@ -348,7 +349,7 @@
 	base.ExitIfErrors()
 
 	// Now we've reduced the upgrade/downgrade work to a list of path@vers pairs (tasks).
-	// Resolve each one and load direct requirements in parallel.
+	// Resolve each one in parallel.
 	reqs := modload.Reqs()
 	var lookup par.Work
 	for _, t := range tasks {
@@ -367,36 +368,21 @@
 			return
 		}
 		t.m = m
-		// If there is no -u, then we don't need to upgrade the
-		// collected requirements separately from the overall
-		// recalculation of the build list (modload.ReloadBuildList below),
-		// so don't bother doing it now. Doing it now wouldn't be
-		// any slower (because it would prime the cache for later)
-		// but the larger operation below can report more errors in a single run.
-		if getU != "" {
-			list, err := reqs.Required(m)
-			if err != nil {
-				base.Errorf("go get %v: %v", t.arg, err)
-				return
-			}
-			t.req = list
-		}
 	})
 	base.ExitIfErrors()
 
-	// Now we know the specific version of each path@vers along with its requirements.
+	// Now we know the specific version of each path@vers.
 	// The final build list will be the union of three build lists:
 	//	1. the original build list
 	//	2. the modules named on the command line
 	//	3. the upgraded requirements of those modules (if upgrading)
 	// Start building those lists.
-	// This loop collects (2) and the not-yet-upgraded (3).
+	// This loop collects (2).
 	// Also, because the list of paths might have named multiple packages in a single module
 	// (or even the same package multiple times), now that we know the module for each
 	// package, this loop deduplicates multiple references to a given module.
 	// (If a module is mentioned multiple times, the listed target version must be the same each time.)
 	var named []module.Version
-	var required []module.Version
 	byPath := make(map[string]*task)
 	for _, t := range tasks {
 		prev, ok := byPath[t.m.Path]
@@ -410,7 +396,6 @@
 		}
 		byPath[t.m.Path] = t
 		named = append(named, t.m)
-		required = append(required, t.req...)
 	}
 	base.ExitIfErrors()
 
@@ -419,16 +404,19 @@
 	// chase down the full list of upgraded dependencies.
 	// This turns required from a not-yet-upgraded (3) to the final (3).
 	// (See list above.)
-	if len(required) > 0 {
+	var required []module.Version
+	if getU != "" {
 		upgraded, err := mvs.UpgradeAll(upgradeTarget, &upgrader{
 			Reqs:    modload.Reqs(),
-			targets: required,
+			targets: named,
 			patch:   getU == "patch",
+			tasks:   byPath,
 		})
 		if err != nil {
 			base.Fatalf("go get: %v", err)
 		}
 		required = upgraded[1:] // slice off upgradeTarget
+		base.ExitIfErrors()
 	}
 
 	// Put together the final build list as described above (1) (2) (3).
@@ -441,8 +429,9 @@
 	list = append(list, required...)
 	modload.SetBuildList(list)
 	modload.ReloadBuildList() // note: does not update go.mod
+	base.ExitIfErrors()
 
-	// Apply any needed downgrades.
+	// Scan for and apply any needed downgrades.
 	var down []module.Version
 	for _, m := range modload.BuildList() {
 		t := byPath[m.Path]
@@ -458,8 +447,64 @@
 		modload.SetBuildList(list)
 		modload.ReloadBuildList() // note: does not update go.mod
 	}
+	base.ExitIfErrors()
+
+	// Scan for any upgrades lost by the downgrades.
+	lost := make(map[string]string)
+	for _, m := range modload.BuildList() {
+		t := byPath[m.Path]
+		if t != nil && semver.Compare(m.Version, t.m.Version) != 0 {
+			lost[m.Path] = m.Version
+		}
+	}
+	if len(lost) > 0 {
+		desc := func(m module.Version) string {
+			s := m.Path + "@" + m.Version
+			t := byPath[m.Path]
+			if t != nil && t.arg != s {
+				s += " from " + t.arg
+			}
+			return s
+		}
+		downByPath := make(map[string]module.Version)
+		for _, d := range down {
+			downByPath[d.Path] = d
+		}
+		var buf strings.Builder
+		fmt.Fprintf(&buf, "go get: inconsistent versions:")
+		for _, t := range tasks {
+			if lost[t.m.Path] == "" {
+				continue
+			}
+			// We lost t because its build list requires a newer version of something in down.
+			// Figure out exactly what.
+			// Repeatedly constructing the build list is inefficient
+			// if there are MANY command-line arguments,
+			// but at least all the necessary requirement lists are cached at this point.
+			list, err := mvs.BuildList(t.m, reqs)
+			if err != nil {
+				base.Fatalf("go get: %v", err)
+			}
+
+			fmt.Fprintf(&buf, "\n\t%s", desc(t.m))
+			sep := " requires"
+			for _, m := range list {
+				if down, ok := downByPath[m.Path]; ok && semver.Compare(down.Version, m.Version) < 0 {
+					fmt.Fprintf(&buf, "%s %s@%s (not %s)", sep, m.Path, m.Version, desc(down))
+					sep = ","
+				}
+			}
+			if sep != "," {
+				// We have no idea why this happened.
+				// At least report the problem.
+				fmt.Fprintf(&buf, " ended up at %v unexpectedly (please report at golang.org/issue/new)", lost[t.m.Path])
+			}
+		}
+		base.Fatalf("%v", buf.String())
+	}
 
 	// Everything succeeded. Update go.mod.
+	modload.AllowWriteGoMod()
 	modload.WriteGoMod()
 
 	// If -m was specified, we're done after the module work. No download, no build.
@@ -545,6 +590,7 @@
 	mvs.Reqs
 	targets []module.Version
 	patch   bool
+	tasks   map[string]*task
 }
 
 // upgradeTarget is a fake "target" requiring all the modules to be upgraded.
@@ -567,6 +613,17 @@
 // This special case prevents accidental downgrades
 // when already using a pseudo-version newer than the latest tagged version.
 func (u *upgrader) Upgrade(m module.Version) (module.Version, error) {
+	// Allow pkg@vers on the command line to override the upgrade choice v.
+	// If t's version is < v, then we're going to downgrade anyway,
+	// and it's cleaner to avoid moving back and forth and picking up
+	// extraneous other newer dependencies.
+	// If t's version is > v, then we're going to upgrade past v anyway,
+	// and again it's cleaner to avoid moving back and forth picking up
+	// extraneous other newer dependencies.
+	if t := u.tasks[m.Path]; t != nil {
+		return t.m, nil
+	}
+
 	// Note that query "latest" is not the same as
 	// using repo.Latest.
 	// The query only falls back to untagged versions
@@ -603,5 +660,6 @@
 	if mTime, err := modfetch.PseudoVersionTime(m.Version); err == nil && info.Time.Before(mTime) {
 		return m, nil
 	}
+
 	return module.Version{Path: m.Path, Version: info.Version}, nil
 }
diff --git a/vendor/cmd/go/internal/modinfo/info.go b/vendor/cmd/go/internal/modinfo/info.go
index 3920546..7341ce4 100644
--- a/vendor/cmd/go/internal/modinfo/info.go
+++ b/vendor/cmd/go/internal/modinfo/info.go
@@ -10,16 +10,18 @@
 // and the fields are documented in the help text in ../list/list.go
 
 type ModulePublic struct {
-	Path     string        `json:",omitempty"` // module path
-	Version  string        `json:",omitempty"` // module version
-	Versions []string      `json:",omitempty"` // available module versions
-	Replace  *ModulePublic `json:",omitempty"` // replaced by this module
-	Time     *time.Time    `json:",omitempty"` // time version was created
-	Update   *ModulePublic `json:",omitempty"` // available update (with -u)
-	Main     bool          `json:",omitempty"` // is this the main module?
-	Indirect bool          `json:",omitempty"` // module is only indirectly needed by main module
-	Dir      string        `json:",omitempty"` // directory holding local copy of files, if any
-	Error    *ModuleError  `json:",omitempty"` // error loading module
+	Path      string        `json:",omitempty"` // module path
+	Version   string        `json:",omitempty"` // module version
+	Versions  []string      `json:",omitempty"` // available module versions
+	Replace   *ModulePublic `json:",omitempty"` // replaced by this module
+	Time      *time.Time    `json:",omitempty"` // time version was created
+	Update    *ModulePublic `json:",omitempty"` // available update (with -u)
+	Main      bool          `json:",omitempty"` // is this the main module?
+	Indirect  bool          `json:",omitempty"` // module is only indirectly needed by main module
+	Dir       string        `json:",omitempty"` // directory holding local copy of files, if any
+	GoMod     string        `json:",omitempty"` // path to go.mod file describing module, if any
+	Error     *ModuleError  `json:",omitempty"` // error loading module
+	GoVersion string        `json:",omitempty"` // go version used in module
 }
 
 type ModuleError struct {
diff --git a/vendor/cmd/go/internal/modload/build.go b/vendor/cmd/go/internal/modload/build.go
index 85172e8..b989af2 100644
--- a/vendor/cmd/go/internal/modload/build.go
+++ b/vendor/cmd/go/internal/modload/build.go
@@ -86,12 +86,17 @@
 
 func moduleInfo(m module.Version, fromBuildList bool) *modinfo.ModulePublic {
 	if m == Target {
-		return &modinfo.ModulePublic{
+		info := &modinfo.ModulePublic{
 			Path:    m.Path,
 			Version: m.Version,
 			Main:    true,
 			Dir:     ModRoot,
+			GoMod:   filepath.Join(ModRoot, "go.mod"),
 		}
+		if modFile.Go != nil {
+			info.GoVersion = modFile.Go.Version
+		}
+		return info
 	}
 
 	info := &modinfo.ModulePublic{
@@ -99,8 +104,11 @@
 		Version:  m.Version,
 		Indirect: fromBuildList && loaded != nil && !loaded.direct[m.Path],
 	}
+	if loaded != nil {
+		info.GoVersion = loaded.goVersion[m.Path]
+	}
 
-	if cfg.BuildGetmode == "vendor" {
+	if cfg.BuildMod == "vendor" {
 		info.Dir = filepath.Join(ModRoot, "vendor", m.Path)
 		return info
 	}
@@ -114,14 +122,22 @@
 				m.Version = q.Version
 				m.Time = &q.Time
 			}
-			dir, err := modfetch.DownloadDir(module.Version{Path: m.Path, Version: m.Version})
+
+			mod := module.Version{Path: m.Path, Version: m.Version}
+			gomod, err := modfetch.CachePath(mod, "mod")
+			if err == nil {
+				if info, err := os.Stat(gomod); err == nil && info.Mode().IsRegular() {
+					m.GoMod = gomod
+				}
+			}
+			dir, err := modfetch.DownloadDir(mod)
 			if err == nil {
 				if info, err := os.Stat(dir); err == nil && info.IsDir() {
 					m.Dir = dir
 				}
 			}
 		}
-		if cfg.BuildGetmode == "vendor" {
+		if cfg.BuildMod == "vendor" {
 			m.Dir = filepath.Join(ModRoot, "vendor", m.Path)
 		}
 	}
@@ -130,8 +146,9 @@
 
 	if r := Replacement(m); r.Path != "" {
 		info.Replace = &modinfo.ModulePublic{
-			Path:    r.Path,
-			Version: r.Version,
+			Path:      r.Path,
+			Version:   r.Version,
+			GoVersion: info.GoVersion,
 		}
 		if r.Version == "" {
 			if filepath.IsAbs(r.Path) {
@@ -142,6 +159,7 @@
 		}
 		complete(info.Replace)
 		info.Dir = info.Replace.Dir
+		info.GoMod = filepath.Join(info.Dir, "go.mod")
 		info.Error = nil // ignore error loading original module version (it has been replaced)
 	}
 
diff --git a/vendor/cmd/go/internal/modload/help.go b/vendor/cmd/go/internal/modload/help.go
index 3efa708..64c70b7 100644
--- a/vendor/cmd/go/internal/modload/help.go
+++ b/vendor/cmd/go/internal/modload/help.go
@@ -20,12 +20,12 @@
 Modules replace the old GOPATH-based approach to specifying
 which source files are used in a given build.
 
-Experimental module support
+Preliminary module support
 
-Go 1.11 includes experimental support for Go modules,
+Go 1.11 includes preliminary support for Go modules,
 including a new module-aware 'go get' command.
 We intend to keep revising this support, while preserving compatibility,
-until it can be declared official (no longer experimental),
+until it can be declared official (no longer preliminary),
 and then at a later point we may remove support for work
 in GOPATH and the old 'go get' command.
 
@@ -50,7 +50,7 @@
 containing a go.mod file.
 
 In module-aware mode, GOPATH no longer defines the meaning of imports
-during a build, but it still stores downloaded dependencies (in GOPATH/src/mod)
+during a build, but it still stores downloaded dependencies (in GOPATH/pkg/mod)
 and installed commands (in GOPATH/bin, unless GOBIN is set).
 
 Defining a module
@@ -85,12 +85,12 @@
 
 To start a new module, simply create a go.mod file in the root of the
 module's directory tree, containing only a module statement.
-The 'go mod' command can be used to do this:
+The 'go mod init' command can be used to do this:
 
-	go mod -init -module example.com/m
+	go mod init example.com/m
 
 In a project already using an existing dependency management tool like
-godep, glide, or dep, 'go mod -init' will also add require statements
+godep, glide, or dep, 'go mod init' will also add require statements
 matching the existing configuration.
 
 Once the go.mod file exists, no additional steps are required:
@@ -147,7 +147,7 @@
 is no longer necessary and can be deleted requires a full view of
 all packages in the module, across all possible build configurations
 (architectures, operating systems, build tags, and so on).
-The 'go mod -sync' command builds that view and then
+The 'go mod tidy' command builds that view and then
 adds any missing module requirements and removes unnecessary ones.
 
 As part of maintaining the require statements in go.mod, the go command
@@ -173,6 +173,19 @@
 The 'go mod' command provides other functionality for use in maintaining
 and understanding modules and go.mod files. See 'go help mod'.
 
+The -mod build flag provides additional control over updating and use of go.mod.
+
+If invoked with -mod=readonly, the go command is disallowed from the implicit
+automatic updating of go.mod described above. Instead, it fails when any changes
+to go.mod are needed. This setting is most useful to check that go.mod does
+not need updates, such as in a continuous integration and testing system.
+The "go get" command remains permitted to update go.mod even with -mod=readonly,
+and the "go mod" commands do not take the -mod flag (or any other build flags).
+
+If invoked with -mod=vendor, the go command assumes that the vendor
+directory holds the correct copies of dependencies and ignores
+the dependency descriptions in go.mod.
+
 Pseudo-versions
 
 The go.mod file and the go command more generally use semantic versions as
@@ -337,7 +350,7 @@
 and records the cryptographic checksum of each package at download time.
 In normal operation, the go command checks these pre-computed checksums
 against the main module's go.sum file, instead of recomputing them on
-each command invocation. The 'go mod -verify' command checks that
+each command invocation. The 'go mod verify' command checks that
 the cached copies of module downloads still match both their recorded
 checksums and the entries in go.sum.
 
@@ -356,14 +369,14 @@
 from their sources and using those downloaded copies (after verification,
 as described in the previous section). To allow interoperation with older
 versions of Go, or to ensure that all files used for a build are stored
-together in a single file tree, 'go mod -vendor' creates a directory named
+together in a single file tree, 'go mod vendor' creates a directory named
 vendor in the root directory of the main module and stores there all the
 packages from dependency modules that are needed to support builds and
 tests of packages in the main module.
 
 To build using the main module's top-level vendor directory to satisfy
 dependencies (disabling use of the usual network sources and local
-caches), use 'go build -getmode=vendor'. Note that only the main module's
+caches), use 'go build -mod=vendor'. Note that only the main module's
 top-level vendor directory is used; vendor directories in other locations
 are still ignored.
 	`,
diff --git a/vendor/cmd/go/internal/modload/import.go b/vendor/cmd/go/internal/modload/import.go
index e9dff9f..f0e7d86 100644
--- a/vendor/cmd/go/internal/modload/import.go
+++ b/vendor/cmd/go/internal/modload/import.go
@@ -66,9 +66,9 @@
 		}
 	}
 
-	// -getmode=vendor is special.
+	// -mod=vendor is special.
 	// Everything must be in the main module or the main module's vendor directory.
-	if cfg.BuildGetmode == "vendor" {
+	if cfg.BuildMod == "vendor" {
 		mainDir, mainOK := dirInModule(path, Target.Path, ModRoot, true)
 		vendorDir, vendorOK := dirInModule(path, "", filepath.Join(ModRoot, "vendor"), false)
 		if mainOK && vendorOK {
@@ -146,8 +146,8 @@
 
 	// Look up module containing the package, for addition to the build list.
 	// Goal is to determine the module, download it to dir, and return m, dir, ErrMissing.
-	if cfg.BuildGetmode == "local" {
-		return module.Version{}, "", fmt.Errorf("import lookup disabled by -getmode=local")
+	if cfg.BuildMod == "readonly" {
+		return module.Version{}, "", fmt.Errorf("import lookup disabled by -mod=%s", cfg.BuildMod)
 	}
 
 	for p := path; p != "."; p = pathpkg.Dir(p) {
diff --git a/vendor/cmd/go/internal/modload/init.go b/vendor/cmd/go/internal/modload/init.go
index dfab657..8ce0c32 100644
--- a/vendor/cmd/go/internal/modload/init.go
+++ b/vendor/cmd/go/internal/modload/init.go
@@ -30,7 +30,6 @@
 
 var (
 	cwd            string
-	enabled        = MustUseModules
 	MustUseModules = mustUseModules()
 	initialized    bool
 
@@ -41,8 +40,8 @@
 
 	gopath string
 
-	CmdModInit   bool   // go mod -init flag
-	CmdModModule string // go mod -module flag
+	CmdModInit   bool   // running 'go mod init'
+	CmdModModule string // module argument for 'go mod init'
 )
 
 // ModFile returns the parsed go.mod file.
@@ -58,9 +57,7 @@
 }
 
 func BinDir() string {
-	if !Enabled() {
-		panic("modload.BinDir")
-	}
+	MustInit()
 	return filepath.Join(gopath, "bin")
 }
 
@@ -74,6 +71,8 @@
 	return strings.HasPrefix(name, "vgo")
 }
 
+var inGOPATH bool // running in GOPATH/src
+
 func Init() {
 	if initialized {
 		return
@@ -94,12 +93,6 @@
 		}
 	}
 
-	// If this is testgo - the test binary during cmd/go tests -
-	// then do not let it look for a go.mod unless GO111MODULE has an explicit setting or this is 'go mod -init'.
-	if base := filepath.Base(os.Args[0]); (base == "testgo" || base == "testgo.exe") && env == "" && !CmdModInit {
-		return
-	}
-
 	// Disable any prompting for passwords by Git.
 	// Only has an effect for 2.3.0 or later, but avoiding
 	// the prompt in earlier versions is just too hard.
@@ -133,7 +126,7 @@
 		base.Fatalf("go: %v", err)
 	}
 
-	inGOPATH := false
+	inGOPATH = false
 	for _, gopath := range filepath.SplitList(cfg.BuildContext.GOPATH) {
 		if gopath == "" {
 			continue
@@ -143,41 +136,26 @@
 			break
 		}
 	}
-	if inGOPATH && !MustUseModules && cfg.CmdName == "mod" {
-		base.Fatalf("go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'")
+
+	if inGOPATH && !MustUseModules {
+		// No automatic enabling in GOPATH.
+		if root, _ := FindModuleRoot(cwd, "", false); root != "" {
+			cfg.GoModInGOPATH = filepath.Join(root, "go.mod")
+		}
+		return
 	}
 
 	if CmdModInit {
-		// Running 'go mod -init': go.mod will be created in current directory.
+		// Running 'go mod init': go.mod will be created in current directory.
 		ModRoot = cwd
 	} else {
-		if inGOPATH && !MustUseModules {
-			// No automatic enabling in GOPATH.
-			if root, _ := FindModuleRoot(cwd, "", false); root != "" {
-				cfg.GoModInGOPATH = filepath.Join(root, "go.mod")
-			}
+		ModRoot, _ = FindModuleRoot(cwd, "", MustUseModules)
+		if ModRoot == "" && !MustUseModules {
 			return
 		}
-		root, _ := FindModuleRoot(cwd, "", MustUseModules)
-		if root == "" {
-			// If invoked as vgo, insist on a mod file.
-			if MustUseModules {
-				base.Fatalf("go: cannot find main module root; see 'go help modules'")
-			}
-			return
-		}
-
-		ModRoot = root
-	}
-
-	if c := cache.Default(); c == nil {
-		// With modules, there are no install locations for packages
-		// other than the build cache.
-		base.Fatalf("go: cannot use modules with build cache disabled")
 	}
 
 	cfg.ModulesEnabled = true
-	enabled = true
 	load.ModBinDir = BinDir
 	load.ModLookup = Lookup
 	load.ModPackageModuleInfo = PackageModuleInfo
@@ -189,15 +167,60 @@
 	search.SetModRoot(ModRoot)
 }
 
+func init() {
+	load.ModInit = Init
+
+	// Set modfetch.PkgMod unconditionally, so that go clean -modcache can run even without modules enabled.
+	if list := filepath.SplitList(cfg.BuildContext.GOPATH); len(list) > 0 && list[0] != "" {
+		modfetch.PkgMod = filepath.Join(list[0], "pkg/mod")
+	}
+}
+
+// Enabled reports whether modules are (or must be) enabled.
+// If modules must be enabled but are not, Enabled returns true
+// and then the first use of module information will call die
+// (usually through InitMod and MustInit).
 func Enabled() bool {
 	if !initialized {
 		panic("go: Enabled called before Init")
 	}
-	return enabled
+	return ModRoot != "" || MustUseModules
+}
+
+// MustInit calls Init if needed and checks that
+// modules are enabled and the main module has been found.
+// If not, MustInit calls base.Fatalf with an appropriate message.
+func MustInit() {
+	if Init(); ModRoot == "" {
+		die()
+	}
+	if c := cache.Default(); c == nil {
+		// With modules, there are no install locations for packages
+		// other than the build cache.
+		base.Fatalf("go: cannot use modules with build cache disabled")
+	}
+}
+
+// Failed reports whether module loading failed.
+// If Failed returns true, then any use of module information will call die.
+func Failed() bool {
+	Init()
+	return cfg.ModulesEnabled && ModRoot == ""
+}
+
+func die() {
+	if os.Getenv("GO111MODULE") == "off" {
+		base.Fatalf("go: modules disabled by GO111MODULE=off; see 'go help modules'")
+	}
+	if inGOPATH && !MustUseModules {
+		base.Fatalf("go: modules disabled inside GOPATH/src by GO111MODULE=auto; see 'go help modules'")
+	}
+	base.Fatalf("go: cannot find main module; see 'go help modules'")
 }
 
 func InitMod() {
-	if Init(); !Enabled() || modFile != nil {
+	MustInit()
+	if modFile != nil {
 		return
 	}
 
@@ -210,23 +233,23 @@
 		base.Fatalf("$GOPATH/go.mod exists but should not")
 	}
 
-	srcV := filepath.Join(list[0], "src/v")
-	srcMod := filepath.Join(list[0], "src/mod")
-	infoV, errV := os.Stat(srcV)
-	_, errMod := os.Stat(srcMod)
-	if errV == nil && infoV.IsDir() && errMod != nil && os.IsNotExist(errMod) {
-		os.Rename(srcV, srcMod)
+	oldSrcMod := filepath.Join(list[0], "src/mod")
+	pkgMod := filepath.Join(list[0], "pkg/mod")
+	infoOld, errOld := os.Stat(oldSrcMod)
+	_, errMod := os.Stat(pkgMod)
+	if errOld == nil && infoOld.IsDir() && errMod != nil && os.IsNotExist(errMod) {
+		os.Rename(oldSrcMod, pkgMod)
 	}
 
-	modfetch.SrcMod = srcMod
+	modfetch.PkgMod = pkgMod
 	modfetch.GoSumFile = filepath.Join(ModRoot, "go.sum")
-	codehost.WorkRoot = filepath.Join(srcMod, "cache/vcs")
+	codehost.WorkRoot = filepath.Join(pkgMod, "cache/vcs")
 
 	if CmdModInit {
-		// Running go mod -init: do legacy module conversion
-		// (go.mod does not exist yet, and it's not our job to write it).
+		// Running go mod init: do legacy module conversion
 		legacyModInit()
 		modFileToBuildList()
+		WriteGoMod()
 		return
 	}
 
@@ -382,7 +405,7 @@
 // Exported only for testing.
 func FindModulePath(dir string) (string, error) {
 	if CmdModModule != "" {
-		// Running go mod -init -module=x/y/z; return x/y/z.
+		// Running go mod init x/y/z; return x/y/z.
 		return CmdModModule, nil
 	}
 
@@ -465,18 +488,46 @@
 	return path
 }
 
+var allowWriteGoMod = true
+
+// DisallowWriteGoMod causes future calls to WriteGoMod to do nothing at all.
+func DisallowWriteGoMod() {
+	allowWriteGoMod = false
+}
+
+// AllowWriteGoMod undoes the effect of DisallowWriteGoMod:
+// future calls to WriteGoMod will update go.mod if needed.
+// Note that any past calls have been discarded, so typically
+// a call to AlowWriteGoMod should be followed by a call to WriteGoMod.
+func AllowWriteGoMod() {
+	allowWriteGoMod = true
+}
+
+// MinReqs returns a Reqs with minimal dependencies of Target,
+// as will be written to go.mod.
+func MinReqs() mvs.Reqs {
+	var direct []string
+	for _, m := range buildList[1:] {
+		if loaded.direct[m.Path] {
+			direct = append(direct, m.Path)
+		}
+	}
+	min, err := mvs.Req(Target, buildList, direct, Reqs())
+	if err != nil {
+		base.Fatalf("go: %v", err)
+	}
+	return &mvsReqs{buildList: append([]module.Version{Target}, min...)}
+}
+
 // WriteGoMod writes the current build list back to go.mod.
 func WriteGoMod() {
-	modfetch.WriteGoSum()
+	if !allowWriteGoMod {
+		return
+	}
 
 	if loaded != nil {
-		var direct []string
-		for _, m := range buildList[1:] {
-			if loaded.direct[m.Path] {
-				direct = append(direct, m.Path)
-			}
-		}
-		min, err := mvs.Req(Target, buildList, direct, Reqs())
+		reqs := MinReqs()
+		min, err := reqs.Required(Target)
 		if err != nil {
 			base.Fatalf("go: %v", err)
 		}
@@ -497,12 +548,15 @@
 	if err != nil {
 		base.Fatalf("go: %v", err)
 	}
-	if bytes.Equal(old, new) {
-		return
+	if !bytes.Equal(old, new) {
+		if cfg.BuildMod == "readonly" {
+			base.Fatalf("go: updates to go.mod needed, disabled by -mod=readonly")
+		}
+		if err := ioutil.WriteFile(file, new, 0666); err != nil {
+			base.Fatalf("go: %v", err)
+		}
 	}
-	if err := ioutil.WriteFile(file, new, 0666); err != nil {
-		base.Fatalf("go: %v", err)
-	}
+	modfetch.WriteGoSum()
 }
 
 func fixVersion(path, vers string) (string, error) {
diff --git a/vendor/cmd/go/internal/modload/load.go b/vendor/cmd/go/internal/modload/load.go
index 5333c65..9c55044 100644
--- a/vendor/cmd/go/internal/modload/load.go
+++ b/vendor/cmd/go/internal/modload/load.go
@@ -11,6 +11,7 @@
 	"go/build"
 	"io/ioutil"
 	"os"
+	"path"
 	"path/filepath"
 	"sort"
 	"strings"
@@ -50,9 +51,6 @@
 // ImportPaths returns the set of packages matching the args (patterns),
 // adding modules to the build list as needed to satisfy new imports.
 func ImportPaths(args []string) []string {
-	if Init(); !Enabled() {
-		return search.ImportPaths(args)
-	}
 	InitMod()
 
 	cleaned := search.CleanImportPaths(args)
@@ -63,17 +61,26 @@
 		paths = nil
 		for _, pkg := range cleaned {
 			switch {
-			case build.IsLocalImport(pkg):
+			case build.IsLocalImport(pkg) || filepath.IsAbs(pkg):
 				list := []string{pkg}
 				if strings.Contains(pkg, "...") {
 					// TODO: Where is the go.mod cutoff?
 					list = warnPattern(pkg, search.AllPackagesInFS(pkg))
 				}
 				for _, pkg := range list {
-					dir := filepath.Join(cwd, pkg)
+					dir := pkg
+					if !filepath.IsAbs(dir) {
+						dir = filepath.Join(cwd, pkg)
+					} else {
+						dir = filepath.Clean(dir)
+					}
+
+					// Note: The checks for @ here are just to avoid misinterpreting
+					// the module cache directories (formerly GOPATH/src/mod/foo@v1.5.2/bar).
+					// It's not strictly necessary but helpful to keep the checks.
 					if dir == ModRoot {
 						pkg = Target.Path
-					} else if strings.HasPrefix(dir, ModRoot+string(filepath.Separator)) {
+					} else if strings.HasPrefix(dir, ModRoot+string(filepath.Separator)) && !strings.Contains(dir[len(ModRoot):], "@") {
 						suffix := filepath.ToSlash(dir[len(ModRoot):])
 						if strings.HasPrefix(suffix, "/vendor/") {
 							// TODO getmode vendor check
@@ -81,8 +88,12 @@
 						} else {
 							pkg = Target.Path + suffix
 						}
+					} else if sub := search.InDir(dir, cfg.GOROOTsrc); sub != "" && !strings.Contains(sub, "@") {
+						pkg = filepath.ToSlash(sub)
+					} else if path := pathInModuleCache(dir); path != "" {
+						pkg = path
 					} else {
-						base.Errorf("go: package %s outside module root", pkg)
+						base.Errorf("go: directory %s outside available modules", base.ShortPath(dir))
 						continue
 					}
 					roots = append(roots, pkg)
@@ -115,6 +126,25 @@
 		}
 		return roots
 	})
+
+	// A given module path may be used as itself or as a replacement for another
+	// module, but not both at the same time. Otherwise, the aliasing behavior is
+	// too subtle (see https://golang.org/issue/26607), and we don't want to
+	// commit to a specific behavior at this point.
+	firstPath := make(map[module.Version]string, len(buildList))
+	for _, mod := range buildList {
+		src := mod
+		if rep := Replacement(mod); rep.Path != "" {
+			src = rep
+		}
+		if prev, ok := firstPath[src]; !ok {
+			firstPath[src] = mod.Path
+		} else if prev != mod.Path {
+			base.Errorf("go: %s@%s used for two different module paths (%s and %s)", mod.Path, mod.Version, prev, mod.Path)
+		}
+	}
+	base.ExitIfErrors()
+
 	WriteGoMod()
 
 	// Process paths to produce final paths list.
@@ -140,6 +170,24 @@
 	return final
 }
 
+// pathInModuleCache returns the import path of the directory dir,
+// if dir is in the module cache copy of a module in our build list.
+func pathInModuleCache(dir string) string {
+	for _, m := range buildList[1:] {
+		root, err := modfetch.DownloadDir(m)
+		if err != nil {
+			continue
+		}
+		if sub := search.InDir(dir, root); sub != "" {
+			sub = filepath.ToSlash(sub)
+			if !strings.Contains(sub, "/vendor/") && !strings.HasPrefix(sub, "vendor/") && !strings.Contains(sub, "@") {
+				return path.Join(m.Path, filepath.ToSlash(sub))
+			}
+		}
+	}
+	return ""
+}
+
 // warnPattern returns list, the result of matching pattern,
 // but if list is empty then first it prints a warning about
 // the pattern not matching any packages.
@@ -153,9 +201,6 @@
 // ImportFromFiles adds modules to the build list as needed
 // to satisfy the imports in the named Go source files.
 func ImportFromFiles(gofiles []string) {
-	if Init(); !Enabled() {
-		return
-	}
 	InitMod()
 
 	imports, testImports, err := imports.ScanFiles(gofiles, imports.Tags())
@@ -179,9 +224,6 @@
 // (typically in commands that care about the module but
 // no particular package).
 func LoadBuildList() []module.Version {
-	if Init(); !Enabled() {
-		base.Fatalf("go: LoadBuildList called but modules not enabled")
-	}
 	InitMod()
 	ReloadBuildList()
 	WriteGoMod()
@@ -213,9 +255,6 @@
 }
 
 func loadAll(testAll bool) []string {
-	if Init(); !Enabled() {
-		panic("go: misuse of LoadALL/LoadVendor")
-	}
 	InitMod()
 
 	loaded = newLoader()
@@ -339,7 +378,8 @@
 	pkgCache *par.Cache // map from string to *loadPkg
 
 	// computed at end of iterations
-	direct map[string]bool // imported directly by main module
+	direct    map[string]bool   // imported directly by main module
+	goVersion map[string]string // go version recorded in each module
 }
 
 func newLoader() *loader {
@@ -380,7 +420,8 @@
 // which must call add(path) with the import path of each root package.
 func (ld *loader) load(roots func() []string) {
 	var err error
-	buildList, err = mvs.BuildList(Target, Reqs())
+	reqs := Reqs()
+	buildList, err = mvs.BuildList(Target, reqs)
 	if err != nil {
 		base.Fatalf("go: %v", err)
 	}
@@ -426,7 +467,8 @@
 		}
 
 		// Recompute buildList with all our additions.
-		buildList, err = mvs.BuildList(Target, Reqs())
+		reqs = Reqs()
+		buildList, err = mvs.BuildList(Target, reqs)
 		if err != nil {
 			base.Fatalf("go: %v", err)
 		}
@@ -445,6 +487,13 @@
 		}
 	}
 
+	// Add Go versions, computed during walk.
+	ld.goVersion = make(map[string]string)
+	for _, m := range buildList {
+		v, _ := reqs.(*mvsReqs).versions.Load(m)
+		ld.goVersion[m.Path], _ = v.(string)
+	}
+
 	// Mix in direct markings (really, lack of indirect markings)
 	// from go.mod, unless we scanned the whole module
 	// and can therefore be sure we know better than go.mod.
@@ -494,7 +543,17 @@
 		pkg.mod = pkg.testOf.mod
 		imports = pkg.testOf.testImports
 	} else {
-		pkg.mod, pkg.dir, pkg.err = ld.doImport(pkg.path)
+		if strings.Contains(pkg.path, "@") {
+			// Leave for error during load.
+			return
+		}
+		if build.IsLocalImport(pkg.path) {
+			// Leave for error during load.
+			// (Module mode does not allow local imports.)
+			return
+		}
+
+		pkg.mod, pkg.dir, pkg.err = Import(pkg.path)
 		if pkg.dir == "" {
 			return
 		}
@@ -526,26 +585,6 @@
 	}
 }
 
-// doImport finds the directory holding source code for the given import path.
-// It returns the module containing the package (if any),
-// the directory containing the package (if any),
-// and any error encountered.
-// Not all packages have modules: the ones in the standard library do not.
-// Not all packages have directories: "unsafe" and "C" do not.
-func (ld *loader) doImport(path string) (mod module.Version, dir string, err error) {
-	if strings.Contains(path, "@") {
-		// Leave for error during load.
-		return module.Version{}, "", nil
-	}
-	if build.IsLocalImport(path) {
-		// Leave for error during load.
-		// (Module mode does not allow local imports.)
-		return module.Version{}, "", nil
-	}
-
-	return Import(path)
-}
-
 // scanDir is like imports.ScanDir but elides known magic imports from the list,
 // so that we do not go looking for packages that don't really exist.
 //
@@ -644,6 +683,7 @@
 		// Happens during testing.
 		return module.Version{}
 	}
+
 	var found *modfile.Replace
 	for _, r := range modFile.Replace {
 		if r.Old.Path == mod.Path && (r.Old.Version == "" || r.Old.Version == mod.Version) {
@@ -661,6 +701,7 @@
 type mvsReqs struct {
 	buildList []module.Version
 	cache     par.Cache
+	versions  sync.Map
 }
 
 // Reqs returns the current module requirement graph.
@@ -736,14 +777,24 @@
 	})
 }
 
+func (r *mvsReqs) modFileToList(f *modfile.File) []module.Version {
+	var list []module.Version
+	for _, r := range f.Require {
+		list = append(list, r.Mod)
+	}
+	return list
+}
+
 func (r *mvsReqs) required(mod module.Version) ([]module.Version, error) {
 	if mod == Target {
+		if modFile.Go != nil {
+			r.versions.LoadOrStore(mod, modFile.Go.Version)
+		}
 		var list []module.Version
-		list = append(list, r.buildList[1:]...)
-		return list, nil
+		return append(list, r.buildList[1:]...), nil
 	}
 
-	if cfg.BuildGetmode == "vendor" {
+	if cfg.BuildMod == "vendor" {
 		// For every module other than the target,
 		// return the full list of modules from modules.txt.
 		readVendorList()
@@ -764,16 +815,15 @@
 				base.Errorf("go: parsing %s: %v", base.ShortPath(gomod), err)
 				return nil, ErrRequire
 			}
-			f, err := modfile.Parse(gomod, data, nil)
+			f, err := modfile.ParseLax(gomod, data, nil)
 			if err != nil {
 				base.Errorf("go: parsing %s: %v", base.ShortPath(gomod), err)
 				return nil, ErrRequire
 			}
-			var list []module.Version
-			for _, r := range f.Require {
-				list = append(list, r.Mod)
+			if f.Go != nil {
+				r.versions.LoadOrStore(mod, f.Go.Version)
 			}
-			return list, nil
+			return r.modFileToList(f), nil
 		}
 		mod = repl
 	}
@@ -792,7 +842,7 @@
 		base.Errorf("go: %s@%s: %v\n", mod.Path, mod.Version, err)
 		return nil, ErrRequire
 	}
-	f, err := modfile.Parse("go.mod", data, nil)
+	f, err := modfile.ParseLax("go.mod", data, nil)
 	if err != nil {
 		base.Errorf("go: %s@%s: parsing go.mod: %v", mod.Path, mod.Version, err)
 		return nil, ErrRequire
@@ -806,12 +856,11 @@
 		base.Errorf("go: %s@%s: parsing go.mod: unexpected module path %q", mod.Path, mod.Version, mpath)
 		return nil, ErrRequire
 	}
-
-	var list []module.Version
-	for _, req := range f.Require {
-		list = append(list, req.Mod)
+	if f.Go != nil {
+		r.versions.LoadOrStore(mod, f.Go.Version)
 	}
-	return list, nil
+
+	return r.modFileToList(f), nil
 }
 
 // ErrRequire is the sentinel error returned when Require encounters problems.
diff --git a/vendor/cmd/go/internal/modload/query_test.go b/vendor/cmd/go/internal/modload/query_test.go
index 8f8df52..7f3ffab 100644
--- a/vendor/cmd/go/internal/modload/query_test.go
+++ b/vendor/cmd/go/internal/modload/query_test.go
@@ -29,7 +29,7 @@
 		log.Fatal(err)
 	}
 	defer os.RemoveAll(dir)
-	modfetch.SrcMod = filepath.Join(dir, "src/mod")
+	modfetch.PkgMod = filepath.Join(dir, "pkg/mod")
 	codehost.WorkRoot = filepath.Join(dir, "codework")
 	return m.Run()
 }
diff --git a/vendor/cmd/go/internal/module/module.go b/vendor/cmd/go/internal/module/module.go
index 992b19e..03b4011 100644
--- a/vendor/cmd/go/internal/module/module.go
+++ b/vendor/cmd/go/internal/module/module.go
@@ -433,8 +433,22 @@
 		return "", err
 	}
 
+	return encodeString(path)
+}
+
+// EncodeVersion returns the safe encoding of the given module version.
+// Versions are allowed to be in non-semver form but must be valid file names
+// and not contain exclamation marks.
+func EncodeVersion(v string) (encoding string, err error) {
+	if err := checkElem(v, true); err != nil || strings.Contains(v, "!") {
+		return "", fmt.Errorf("disallowed version string %q", v)
+	}
+	return encodeString(v)
+}
+
+func encodeString(s string) (encoding string, err error) {
 	haveUpper := false
-	for _, r := range path {
+	for _, r := range s {
 		if r == '!' || r >= utf8.RuneSelf {
 			// This should be disallowed by CheckPath, but diagnose anyway.
 			// The correctness of the encoding loop below depends on it.
@@ -446,11 +460,11 @@
 	}
 
 	if !haveUpper {
-		return path, nil
+		return s, nil
 	}
 
 	var buf []byte
-	for _, r := range path {
+	for _, r := range s {
 		if 'A' <= r && r <= 'Z' {
 			buf = append(buf, '!', byte(r+'a'-'A'))
 		} else {
@@ -461,19 +475,45 @@
 }
 
 // DecodePath returns the module path of the given safe encoding.
-// It fails if the encoding is invalid.
+// It fails if the encoding is invalid or encodes an invalid path.
 func DecodePath(encoding string) (path string, err error) {
+	path, ok := decodeString(encoding)
+	if !ok {
+		return "", fmt.Errorf("invalid module path encoding %q", encoding)
+	}
+	if err := CheckPath(path); err != nil {
+		return "", fmt.Errorf("invalid module path encoding %q: %v", encoding, err)
+	}
+	return path, nil
+}
+
+// DecodeVersion returns the version string for the given safe encoding.
+// It fails if the encoding is invalid or encodes an invalid version.
+// Versions are allowed to be in non-semver form but must be valid file names
+// and not contain exclamation marks.
+func DecodeVersion(encoding string) (v string, err error) {
+	v, ok := decodeString(encoding)
+	if !ok {
+		return "", fmt.Errorf("invalid version encoding %q", encoding)
+	}
+	if err := checkElem(v, true); err != nil {
+		return "", fmt.Errorf("disallowed version string %q", v)
+	}
+	return v, nil
+}
+
+func decodeString(encoding string) (string, bool) {
 	var buf []byte
 
 	bang := false
 	for _, r := range encoding {
 		if r >= utf8.RuneSelf {
-			goto BadEncoding
+			return "", false
 		}
 		if bang {
 			bang = false
 			if r < 'a' || 'z' < r {
-				goto BadEncoding
+				return "", false
 			}
 			buf = append(buf, byte(r+'A'-'a'))
 			continue
@@ -483,19 +523,12 @@
 			continue
 		}
 		if 'A' <= r && r <= 'Z' {
-			goto BadEncoding
+			return "", false
 		}
 		buf = append(buf, byte(r))
 	}
 	if bang {
-		goto BadEncoding
+		return "", false
 	}
-	path = string(buf)
-	if err := CheckPath(path); err != nil {
-		return "", fmt.Errorf("invalid module path encoding %q: %v", encoding, err)
-	}
-	return path, nil
-
-BadEncoding:
-	return "", fmt.Errorf("invalid module path encoding %q", encoding)
+	return string(buf), true
 }
diff --git a/vendor/cmd/go/internal/par/work_test.go b/vendor/cmd/go/internal/par/work_test.go
index 53a715e..f104bc4 100644
--- a/vendor/cmd/go/internal/par/work_test.go
+++ b/vendor/cmd/go/internal/par/work_test.go
@@ -32,9 +32,8 @@
 }
 
 func TestWorkParallel(t *testing.T) {
-	var w Work
-
 	for tries := 0; tries < 10; tries++ {
+		var w Work
 		const N = 100
 		for i := 0; i < N; i++ {
 			w.Add(i)
diff --git a/vendor/cmd/go/internal/run/run.go b/vendor/cmd/go/internal/run/run.go
index 8460d1f..303e684 100644
--- a/vendor/cmd/go/internal/run/run.go
+++ b/vendor/cmd/go/internal/run/run.go
@@ -18,7 +18,7 @@
 )
 
 var CmdRun = &base.Command{
-	UsageLine: "run [build flags] [-exec xprog] package [arguments...]",
+	UsageLine: "go run [build flags] [-exec xprog] package [arguments...]",
 	Short:     "compile and run Go program",
 	Long: `
 Run compiles and runs the named main Go package.
diff --git a/vendor/cmd/go/internal/test/test.go b/vendor/cmd/go/internal/test/test.go
index 80c99b7..d6fcc2a 100644
--- a/vendor/cmd/go/internal/test/test.go
+++ b/vendor/cmd/go/internal/test/test.go
@@ -37,7 +37,7 @@
 	CmdTest.Run = runTest
 }
 
-const testUsage = "test [build/test flags] [packages] [build/test flags & test binary flags]"
+const testUsage = "go test [build/test flags] [packages] [build/test flags & test binary flags]"
 
 var CmdTest = &base.Command{
 	CustomFlags: true,
@@ -168,7 +168,7 @@
 
 // Usage prints the usage message for 'go test -h' and exits.
 func Usage() {
-	os.Stderr.WriteString(testUsage + "\n\n" +
+	os.Stderr.WriteString("usage: " + testUsage + "\n\n" +
 		strings.TrimSpace(testFlag1) + "\n\n\t" +
 		strings.TrimSpace(testFlag2) + "\n")
 	os.Exit(2)
@@ -892,8 +892,10 @@
 		}
 		runAction = installAction // make sure runAction != nil even if not running test
 	}
+	var vetRunAction *work.Action
 	if testC {
 		printAction = &work.Action{Mode: "test print (nop)", Package: p, Deps: []*work.Action{runAction}} // nop
+		vetRunAction = printAction
 	} else {
 		// run test
 		c := new(runCache)
@@ -906,12 +908,7 @@
 			TryCache:   c.tryCache,
 			Objdir:     testDir,
 		}
-		if len(ptest.GoFiles)+len(ptest.CgoFiles) > 0 {
-			addTestVet(b, ptest, runAction, installAction)
-		}
-		if pxtest != nil {
-			addTestVet(b, pxtest, runAction, installAction)
-		}
+		vetRunAction = runAction
 		cleanAction = &work.Action{
 			Mode:       "test clean",
 			Func:       builderCleanTest,
@@ -928,6 +925,14 @@
 			IgnoreFail: true, // print even if test failed
 		}
 	}
+
+	if len(ptest.GoFiles)+len(ptest.CgoFiles) > 0 {
+		addTestVet(b, ptest, vetRunAction, installAction)
+	}
+	if pxtest != nil {
+		addTestVet(b, pxtest, vetRunAction, installAction)
+	}
+
 	if installAction != nil {
 		if runAction != installAction {
 			installAction.Deps = append(installAction.Deps, runAction)
diff --git a/vendor/cmd/go/internal/test/testflag.go b/vendor/cmd/go/internal/test/testflag.go
index 8a686b7..73f8c69 100644
--- a/vendor/cmd/go/internal/test/testflag.go
+++ b/vendor/cmd/go/internal/test/testflag.go
@@ -63,6 +63,7 @@
 
 // add build flags to testFlagDefn
 func init() {
+	cmdflag.AddKnownFlags("test", testFlagDefn)
 	var cmd base.Command
 	work.AddBuildFlags(&cmd)
 	cmd.Flag.VisitAll(func(f *flag.Flag) {
@@ -87,6 +88,7 @@
 //	go test fmt -custom-flag-for-fmt-test
 //	go test -x math
 func testFlags(args []string) (packageNames, passToTest []string) {
+	args = str.StringList(cmdflag.FindGOFLAGS(testFlagDefn), args)
 	inPkg := false
 	var explicitArgs []string
 	for i := 0; i < len(args); i++ {
diff --git a/vendor/cmd/go/internal/tool/tool.go b/vendor/cmd/go/internal/tool/tool.go
index 4c7d089..edcf935 100644
--- a/vendor/cmd/go/internal/tool/tool.go
+++ b/vendor/cmd/go/internal/tool/tool.go
@@ -18,7 +18,7 @@
 
 var CmdTool = &base.Command{
 	Run:       runTool,
-	UsageLine: "tool [-n] command [args...]",
+	UsageLine: "go tool [-n] command [args...]",
 	Short:     "run specified go tool",
 	Long: `
 Tool runs the go tool command identified by the arguments.
diff --git a/vendor/cmd/go/internal/version/version.go b/vendor/cmd/go/internal/version/version.go
index 01d6bfc..e8101d2 100644
--- a/vendor/cmd/go/internal/version/version.go
+++ b/vendor/cmd/go/internal/version/version.go
@@ -15,7 +15,7 @@
 
 var CmdVersion = &base.Command{
 	Run:       runVersion,
-	UsageLine: "version",
+	UsageLine: "go version",
 	Short:     "print Go version",
 	Long:      `Version prints the Go version, as reported by runtime.Version.`,
 }
diff --git a/vendor/cmd/go/internal/version/vgo.go b/vendor/cmd/go/internal/version/vgo.go
index 59cc3b1..bb7c709 100644
--- a/vendor/cmd/go/internal/version/vgo.go
+++ b/vendor/cmd/go/internal/version/vgo.go
@@ -1,3 +1,3 @@
 package version
 
-const version = "devel +88c76dcbab"
+const version = "devel +1b870077c8"
diff --git a/vendor/cmd/go/internal/vet/vet.go b/vendor/cmd/go/internal/vet/vet.go
index 9cb2aaa..11abb62 100644
--- a/vendor/cmd/go/internal/vet/vet.go
+++ b/vendor/cmd/go/internal/vet/vet.go
@@ -15,7 +15,7 @@
 var CmdVet = &base.Command{
 	Run:         runVet,
 	CustomFlags: true,
-	UsageLine:   "vet [-n] [-x] [build flags] [vet flags] [packages]",
+	UsageLine:   "go vet [-n] [-x] [build flags] [vet flags] [packages]",
 	Short:       "report likely mistakes in packages",
 	Long: `
 Vet runs the Go vet command on the packages named by the import paths.
diff --git a/vendor/cmd/go/internal/vet/vetflag.go b/vendor/cmd/go/internal/vet/vetflag.go
index bdfe033..50eac42 100644
--- a/vendor/cmd/go/internal/vet/vetflag.go
+++ b/vendor/cmd/go/internal/vet/vetflag.go
@@ -12,6 +12,7 @@
 
 	"cmd/go/internal/base"
 	"cmd/go/internal/cmdflag"
+	"cmd/go/internal/str"
 	"cmd/go/internal/work"
 )
 
@@ -26,39 +27,40 @@
 	// to vet. We handle them in vetFlags.
 
 	// local.
-	{Name: "all", BoolVar: new(bool)},
-	{Name: "asmdecl", BoolVar: new(bool)},
-	{Name: "assign", BoolVar: new(bool)},
-	{Name: "atomic", BoolVar: new(bool)},
-	{Name: "bool", BoolVar: new(bool)},
-	{Name: "buildtags", BoolVar: new(bool)},
-	{Name: "cgocall", BoolVar: new(bool)},
-	{Name: "composites", BoolVar: new(bool)},
-	{Name: "copylocks", BoolVar: new(bool)},
-	{Name: "httpresponse", BoolVar: new(bool)},
-	{Name: "lostcancel", BoolVar: new(bool)},
-	{Name: "methods", BoolVar: new(bool)},
-	{Name: "nilfunc", BoolVar: new(bool)},
-	{Name: "printf", BoolVar: new(bool)},
-	{Name: "printfuncs"},
-	{Name: "rangeloops", BoolVar: new(bool)},
-	{Name: "shadow", BoolVar: new(bool)},
-	{Name: "shadowstrict", BoolVar: new(bool)},
-	{Name: "shift", BoolVar: new(bool)},
-	{Name: "source", BoolVar: new(bool)},
-	{Name: "structtags", BoolVar: new(bool)},
-	{Name: "tests", BoolVar: new(bool)},
-	{Name: "unreachable", BoolVar: new(bool)},
-	{Name: "unsafeptr", BoolVar: new(bool)},
-	{Name: "unusedfuncs"},
-	{Name: "unusedresult", BoolVar: new(bool)},
-	{Name: "unusedstringmethods"},
+	{Name: "all", BoolVar: new(bool), PassToTest: true},
+	{Name: "asmdecl", BoolVar: new(bool), PassToTest: true},
+	{Name: "assign", BoolVar: new(bool), PassToTest: true},
+	{Name: "atomic", BoolVar: new(bool), PassToTest: true},
+	{Name: "bool", BoolVar: new(bool), PassToTest: true},
+	{Name: "buildtags", BoolVar: new(bool), PassToTest: true},
+	{Name: "cgocall", BoolVar: new(bool), PassToTest: true},
+	{Name: "composites", BoolVar: new(bool), PassToTest: true},
+	{Name: "copylocks", BoolVar: new(bool), PassToTest: true},
+	{Name: "httpresponse", BoolVar: new(bool), PassToTest: true},
+	{Name: "lostcancel", BoolVar: new(bool), PassToTest: true},
+	{Name: "methods", BoolVar: new(bool), PassToTest: true},
+	{Name: "nilfunc", BoolVar: new(bool), PassToTest: true},
+	{Name: "printf", BoolVar: new(bool), PassToTest: true},
+	{Name: "printfuncs", PassToTest: true},
+	{Name: "rangeloops", BoolVar: new(bool), PassToTest: true},
+	{Name: "shadow", BoolVar: new(bool), PassToTest: true},
+	{Name: "shadowstrict", BoolVar: new(bool), PassToTest: true},
+	{Name: "shift", BoolVar: new(bool), PassToTest: true},
+	{Name: "source", BoolVar: new(bool), PassToTest: true},
+	{Name: "structtags", BoolVar: new(bool), PassToTest: true},
+	{Name: "tests", BoolVar: new(bool), PassToTest: true},
+	{Name: "unreachable", BoolVar: new(bool), PassToTest: true},
+	{Name: "unsafeptr", BoolVar: new(bool), PassToTest: true},
+	{Name: "unusedfuncs", PassToTest: true},
+	{Name: "unusedresult", BoolVar: new(bool), PassToTest: true},
+	{Name: "unusedstringmethods", PassToTest: true},
 }
 
 var vetTool string
 
 // add build flags to vetFlagDefn.
 func init() {
+	cmdflag.AddKnownFlags("vet", vetFlagDefn)
 	var cmd base.Command
 	work.AddBuildFlags(&cmd)
 	cmd.Flag.StringVar(&vetTool, "vettool", "", "path to vet tool binary") // for cmd/vet tests; undocumented for now
@@ -73,6 +75,7 @@
 // vetFlags processes the command line, splitting it at the first non-flag
 // into the list of flags and list of packages.
 func vetFlags(args []string) (passToVet, packageNames []string) {
+	args = str.StringList(cmdflag.FindGOFLAGS(vetFlagDefn), args)
 	for i := 0; i < len(args); i++ {
 		if !strings.HasPrefix(args[i], "-") {
 			return args[:i], args[i:]
@@ -88,9 +91,17 @@
 			if err := f.Value.Set(value); err != nil {
 				base.Fatalf("invalid flag argument for -%s: %v", f.Name, err)
 			}
-			switch f.Name {
-			// Flags known to the build but not to vet, so must be dropped.
-			case "a", "x", "n", "vettool", "compiler":
+			keep := f.PassToTest
+			if !keep {
+				// A build flag, probably one we don't want to pass to vet.
+				// Can whitelist.
+				switch f.Name {
+				case "tags", "v":
+					keep = true
+				}
+			}
+			if !keep {
+				// Flags known to the build but not to vet, so must be dropped.
 				if extraWord {
 					args = append(args[:i], args[i+2:]...)
 					extraWord = false
diff --git a/vendor/cmd/go/internal/work/action.go b/vendor/cmd/go/internal/work/action.go
index debf734..1f91046 100644
--- a/vendor/cmd/go/internal/work/action.go
+++ b/vendor/cmd/go/internal/work/action.go
@@ -36,10 +36,10 @@
 	flagCache   map[[2]string]bool   // a cache of supported compiler flags
 	Print       func(args ...interface{}) (int, error)
 
-	IsCmdList    bool // running as part of go list; set p.Stale and additional fields below
-	NeedError    bool // list needs p.Error
-	NeedExport   bool // list needs p.Export
-	NeedCgoFiles bool // list needs p.CgoFiles to cgo-generated files, not originals
+	IsCmdList           bool // running as part of go list; set p.Stale and additional fields below
+	NeedError           bool // list needs p.Error
+	NeedExport          bool // list needs p.Export
+	NeedCompiledGoFiles bool // list needs p.CompiledGoFIles
 
 	objdirSeq int // counter for NewObjdir
 	pkgSeq    int
diff --git a/vendor/cmd/go/internal/work/build.go b/vendor/cmd/go/internal/work/build.go
index d52998f..c2524c4 100644
--- a/vendor/cmd/go/internal/work/build.go
+++ b/vendor/cmd/go/internal/work/build.go
@@ -24,7 +24,7 @@
 )
 
 var CmdBuild = &base.Command{
-	UsageLine: "build [-o output] [-i] [build flags] [packages]",
+	UsageLine: "go build [-o output] [-i] [build flags] [packages]",
 	Short:     "compile packages and dependencies",
 	Long: `
 Build compiles the packages named by the import paths,
@@ -88,8 +88,6 @@
 		arguments to pass on each gccgo compiler/linker invocation.
 	-gcflags '[pattern=]arg list'
 		arguments to pass on each go tool compile invocation.
-	-getmode mode
-		module download mode to use. See 'go help modules' for more.
 	-installsuffix suffix
 		a suffix to use in the name of the package installation directory,
 		in order to keep output separate from default builds.
@@ -102,6 +100,9 @@
 	-linkshared
 		link against shared libraries previously created with
 		-buildmode=shared.
+	-mod mode
+		module download mode to use: readonly, release, or vendor.
+		See 'go help modules' for more.
 	-pkgdir dir
 		install and load all packages from dir instead of the usual locations.
 		For example, when building with a non-standard configuration,
@@ -222,7 +223,7 @@
 	cmd.Flag.StringVar(&cfg.BuildBuildmode, "buildmode", "default", "")
 	cmd.Flag.Var(&load.BuildGcflags, "gcflags", "")
 	cmd.Flag.Var(&load.BuildGccgoflags, "gccgoflags", "")
-	cmd.Flag.StringVar(&cfg.BuildGetmode, "getmode", "", "")
+	cmd.Flag.StringVar(&cfg.BuildMod, "mod", "", "")
 	cmd.Flag.StringVar(&cfg.BuildContext.InstallSuffix, "installsuffix", "", "")
 	cmd.Flag.Var(&load.BuildLdflags, "ldflags", "")
 	cmd.Flag.BoolVar(&cfg.BuildLinkshared, "linkshared", false, "")
@@ -361,7 +362,7 @@
 }
 
 var CmdInstall = &base.Command{
-	UsageLine: "install [-i] [build flags] [packages]",
+	UsageLine: "go install [-i] [build flags] [packages]",
 	Short:     "compile and install packages and dependencies",
 	Long: `
 Install compiles and installs the packages named by the import paths.
diff --git a/vendor/cmd/go/internal/work/exec.go b/vendor/cmd/go/internal/work/exec.go
index d9e1d4d..19ed169 100644
--- a/vendor/cmd/go/internal/work/exec.go
+++ b/vendor/cmd/go/internal/work/exec.go
@@ -320,11 +320,32 @@
 	return false
 }
 
+// allowedVersion reports whether the version v is an allowed version of go
+// (one that we can compile).
+// v is known to be of the form "1.23".
+func allowedVersion(v string) bool {
+	// Special case: no requirement.
+	if v == "" {
+		return true
+	}
+	// Special case "1.0" means "go1", which is OK.
+	if v == "1.0" {
+		return true
+	}
+	// Otherwise look through release tags of form "go1.23" for one that matches.
+	for _, tag := range cfg.BuildContext.ReleaseTags {
+		if strings.HasPrefix(tag, "go") && tag[2:] == v {
+			return true
+		}
+	}
+	return false
+}
+
 const (
 	needBuild uint32 = 1 << iota
 	needCgoHdr
 	needVet
-	needCgoFiles
+	needCompiledGoFiles
 	needStale
 )
 
@@ -344,10 +365,7 @@
 	need := bit(needBuild, !b.IsCmdList || b.NeedExport) |
 		bit(needCgoHdr, b.needCgoHdr(a)) |
 		bit(needVet, a.needVet) |
-		bit(needCgoFiles, b.NeedCgoFiles && (p.UsesCgo() || p.UsesSwig()))
-
-	// Save p.CgoFiles now, because we may modify it for go list.
-	cgofiles := append([]string{}, p.CgoFiles...)
+		bit(needCompiledGoFiles, b.NeedCompiledGoFiles)
 
 	if !p.BinaryOnly {
 		if b.useCache(a, p, b.buildActionID(a), p.Target) {
@@ -357,8 +375,8 @@
 			if b.NeedExport {
 				p.Export = a.built
 			}
-			if need&needCgoFiles != 0 && b.loadCachedCgoFiles(a) {
-				need &^= needCgoFiles
+			if need&needCompiledGoFiles != 0 && b.loadCachedGoFiles(a) {
+				need &^= needCompiledGoFiles
 			}
 			// Otherwise, we need to write files to a.Objdir (needVet, needCgoHdr).
 			// Remember that we might have them in cache
@@ -411,7 +429,11 @@
 		if b.IsCmdList {
 			return nil
 		}
-		return fmt.Errorf("missing or invalid binary-only package")
+		return fmt.Errorf("missing or invalid binary-only package; expected file %q", a.Package.Target)
+	}
+
+	if p.Module != nil && !allowedVersion(p.Module.GoVersion) {
+		return fmt.Errorf("module requires Go %s", p.Module.GoVersion)
 	}
 
 	if err := b.Mkdir(a.Objdir); err != nil {
@@ -444,11 +466,12 @@
 		}
 	}
 
-	var gofiles, cfiles, sfiles, cxxfiles, objects, cgoObjects, pcCFLAGS, pcLDFLAGS []string
-	gofiles = append(gofiles, a.Package.GoFiles...)
-	cfiles = append(cfiles, a.Package.CFiles...)
-	sfiles = append(sfiles, a.Package.SFiles...)
-	cxxfiles = append(cxxfiles, a.Package.CXXFiles...)
+	gofiles := str.StringList(a.Package.GoFiles)
+	cgofiles := str.StringList(a.Package.CgoFiles)
+	cfiles := str.StringList(a.Package.CFiles)
+	sfiles := str.StringList(a.Package.SFiles)
+	cxxfiles := str.StringList(a.Package.CXXFiles)
+	var objects, cgoObjects, pcCFLAGS, pcLDFLAGS []string
 
 	if a.Package.UsesCgo() || a.Package.UsesSwig() {
 		if pcCFLAGS, pcLDFLAGS, err = b.getPkgConfigFlags(a.Package); err != nil {
@@ -569,11 +592,11 @@
 		buildVetConfig(a, gofiles)
 		need &^= needVet
 	}
-	if need&needCgoFiles != 0 {
-		if !b.loadCachedCgoFiles(a) {
-			return fmt.Errorf("failed to cache translated CgoFiles")
+	if need&needCompiledGoFiles != 0 {
+		if !b.loadCachedGoFiles(a) {
+			return fmt.Errorf("failed to cache compiled Go files")
 		}
-		need &^= needCgoFiles
+		need &^= needCompiledGoFiles
 	}
 	if need == 0 {
 		// Nothing left to do.
@@ -811,7 +834,7 @@
 	return true
 }
 
-func (b *Builder) loadCachedCgoFiles(a *Action) bool {
+func (b *Builder) loadCachedGoFiles(a *Action) bool {
 	c := cache.Default()
 	if c == nil {
 		return false
@@ -826,6 +849,7 @@
 			continue
 		}
 		if strings.HasPrefix(name, "./") {
+			files = append(files, name[len("./"):])
 			continue
 		}
 		file, err := b.findCachedObjdirFile(a, c, name)
@@ -834,7 +858,7 @@
 		}
 		files = append(files, file)
 	}
-	a.Package.CgoFiles = files
+	a.Package.CompiledGoFiles = files
 	return true
 }
 
@@ -915,13 +939,17 @@
 
 	a.Failed = false // vet of dependency may have failed but we can still succeed
 
+	if a.Deps[0].Failed {
+		// The build of the package has failed. Skip vet check.
+		// Vet could return export data for non-typecheck errors,
+		// but we ignore it because the package cannot be compiled.
+		return nil
+	}
+
 	vcfg := a.Deps[0].vetCfg
 	if vcfg == nil {
 		// Vet config should only be missing if the build failed.
-		if !a.Deps[0].Failed {
-			return fmt.Errorf("vet config not found")
-		}
-		return nil
+		return fmt.Errorf("vet config not found")
 	}
 
 	vcfg.VetxOnly = a.VetxOnly
diff --git a/vendor/cmd/go/internal/work/init.go b/vendor/cmd/go/internal/work/init.go
index 5308139..eb99815 100644
--- a/vendor/cmd/go/internal/work/init.go
+++ b/vendor/cmd/go/internal/work/init.go
@@ -14,9 +14,11 @@
 	"fmt"
 	"os"
 	"path/filepath"
+	"strings"
 )
 
 func BuildInit() {
+	load.ModInit()
 	instrumentInit()
 	buildModeInit()
 
@@ -226,15 +228,30 @@
 		}
 	}
 
-	switch cfg.BuildGetmode {
+	switch cfg.BuildMod {
 	case "":
 		// ok
-	case "local", "vendor":
-		// ok but check for modules
-		if load.ModLookup == nil {
-			base.Fatalf("build flag -getmode=%s only valid when using modules", cfg.BuildGetmode)
+	case "readonly", "vendor":
+		if load.ModLookup == nil && !inGOFLAGS("-mod") {
+			base.Fatalf("build flag -mod=%s only valid when using modules", cfg.BuildMod)
 		}
 	default:
-		base.Fatalf("-getmode=%s not supported (can be '', 'local', or 'vendor')", cfg.BuildGetmode)
+		base.Fatalf("-mod=%s not supported (can be '', 'readonly', or 'vendor')", cfg.BuildMod)
 	}
 }
+
+func inGOFLAGS(flag string) bool {
+	for _, goflag := range base.GOFLAGS() {
+		name := goflag
+		if strings.HasPrefix(name, "--") {
+			name = name[1:]
+		}
+		if i := strings.Index(name, "="); i >= 0 {
+			name = name[:i]
+		}
+		if name == flag {
+			return true
+		}
+	}
+	return false
+}
diff --git a/vendor/cmd/go/main.go b/vendor/cmd/go/main.go
index a079c49..87997f8 100644
--- a/vendor/cmd/go/main.go
+++ b/vendor/cmd/go/main.go
@@ -28,6 +28,7 @@
 	"cmd/go/internal/help"
 	"cmd/go/internal/list"
 	"cmd/go/internal/modcmd"
+	"cmd/go/internal/modfetch"
 	"cmd/go/internal/modget"
 	"cmd/go/internal/modload"
 	"cmd/go/internal/run"
@@ -39,7 +40,7 @@
 )
 
 func init() {
-	base.Commands = []*base.Command{
+	base.Go.Commands = []*base.Command{
 		bug.CmdBug,
 		work.CmdBuild,
 		clean.CmdClean,
@@ -65,6 +66,7 @@
 		help.HelpFileType,
 		help.HelpGopath,
 		get.HelpGopathGet,
+		modfetch.HelpGoproxy,
 		help.HelpImportPath,
 		modload.HelpModules,
 		modget.HelpModuleGet,
@@ -127,26 +129,42 @@
 		os.Exit(2)
 	}
 
+	// TODO(rsc): Remove all these helper prints in Go 1.12.
 	switch args[0] {
 	case "mod":
-		// Skip modload.Init (which may insist on go.mod existing)
-		// so that go mod -init has a chance to write the file.
-	case "version":
-		// Skip modload.Init so that users can report bugs against
-		// go mod -init.
+		if len(args) >= 2 {
+			flag := args[1]
+			if strings.HasPrefix(flag, "--") {
+				flag = flag[1:]
+			}
+			if i := strings.Index(flag, "="); i >= 0 {
+				flag = flag[:i]
+			}
+			switch flag {
+			case "-sync":
+				fmt.Fprintf(os.Stderr, "go: go mod -sync is now go mod tidy\n")
+				os.Exit(2)
+			case "-init", "-fix", "-graph", "-vendor", "-verify":
+				fmt.Fprintf(os.Stderr, "go: go mod %s is now go mod %s\n", flag, flag[1:])
+				os.Exit(2)
+			case "-fmt", "-json", "-module", "-require", "-droprequire", "-replace", "-dropreplace", "-exclude", "-dropexclude":
+				fmt.Fprintf(os.Stderr, "go: go mod %s is now go mod edit %s\n", flag, flag)
+				os.Exit(2)
+			}
+		}
 	case "vendor":
-		fmt.Fprintf(os.Stderr, "go vendor is now go mod -vendor\n")
+		fmt.Fprintf(os.Stderr, "go: vgo vendor is now go mod vendor\n")
 		os.Exit(2)
 	case "verify":
-		fmt.Fprintf(os.Stderr, "go verify is now go mod -verify\n")
+		fmt.Fprintf(os.Stderr, "go: vgo verify is now go mod verify\n")
 		os.Exit(2)
-	default:
-		// Run modload.Init so that each subcommand doesn't have to worry about it.
-		// Also install the module get command instead of the GOPATH go get command
-		// if modules are enabled.
-		modload.Init()
-		if modload.Enabled() {
-			// Might not have done this above, so do it now.
+	}
+
+	if args[0] == "get" {
+		// Replace get with module-aware get if appropriate.
+		// Note that if MustUseModules is true, this happened already above,
+		// but no harm in doing it again.
+		if modload.Init(); modload.Enabled() {
 			*get.CmdGet = *modget.CmdGet
 		}
 	}
@@ -164,12 +182,36 @@
 		}
 	}
 
-	for _, cmd := range base.Commands {
-		if cmd.Name() == args[0] && cmd.Runnable() {
+BigCmdLoop:
+	for bigCmd := base.Go; ; {
+		for _, cmd := range bigCmd.Commands {
+			if cmd.Name() != args[0] {
+				continue
+			}
+			if len(cmd.Commands) > 0 {
+				bigCmd = cmd
+				args = args[1:]
+				if len(args) == 0 {
+					help.PrintUsage(os.Stderr, bigCmd)
+					base.SetExitStatus(2)
+					base.Exit()
+				}
+				if args[0] == "help" {
+					// Accept 'go mod help' and 'go mod help foo' for 'go help mod' and 'go help mod foo'.
+					help.Help(append(strings.Split(cfg.CmdName, " "), args[1:]...))
+					return
+				}
+				cfg.CmdName += " " + args[0]
+				continue BigCmdLoop
+			}
+			if !cmd.Runnable() {
+				continue
+			}
 			cmd.Flag.Usage = func() { cmd.Usage() }
 			if cmd.CustomFlags {
 				args = args[1:]
 			} else {
+				base.SetFromGOFLAGS(cmd.Flag)
 				cmd.Flag.Parse(args[1:])
 				args = cmd.Flag.Args()
 			}
@@ -177,11 +219,14 @@
 			base.Exit()
 			return
 		}
+		helpArg := ""
+		if i := strings.LastIndex(cfg.CmdName, " "); i >= 0 {
+			helpArg = " " + cfg.CmdName[:i]
+		}
+		fmt.Fprintf(os.Stderr, "go %s: unknown command\nRun 'go help%s' for usage.\n", cfg.CmdName, helpArg)
+		base.SetExitStatus(2)
+		base.Exit()
 	}
-
-	fmt.Fprintf(os.Stderr, "go: unknown subcommand %q\nRun 'go help' for usage.\n", args[0])
-	base.SetExitStatus(2)
-	base.Exit()
 }
 
 func init() {
@@ -193,6 +238,6 @@
 	if len(os.Args) > 1 && os.Args[1] == "test" {
 		test.Usage()
 	}
-	help.PrintUsage(os.Stderr)
+	help.PrintUsage(os.Stderr, base.Go)
 	os.Exit(2)
 }
diff --git a/vendor/cmd/go/proxy_test.go b/vendor/cmd/go/proxy_test.go
index 8dc6070..bd13513 100644
--- a/vendor/cmd/go/proxy_test.go
+++ b/vendor/cmd/go/proxy_test.go
@@ -78,13 +78,18 @@
 		if i < 0 {
 			continue
 		}
-		enc := strings.Replace(name[:i], "_", "/", -1)
-		path, err := module.DecodePath(enc)
+		encPath := strings.Replace(name[:i], "_", "/", -1)
+		path, err := module.DecodePath(encPath)
 		if err != nil {
 			fmt.Fprintf(os.Stderr, "go proxy_test: %v", err)
 			continue
 		}
-		vers := name[i+1:]
+		encVers := name[i+1:]
+		vers, err := module.DecodeVersion(encVers)
+		if err != nil {
+			fmt.Fprintf(os.Stderr, "go proxy_test: %v", err)
+			continue
+		}
 		modList = append(modList, module.Version{Path: path, Version: vers})
 	}
 }
@@ -132,7 +137,13 @@
 		http.NotFound(w, r)
 		return
 	}
-	vers, ext := file[:i], file[i+1:]
+	encVers, ext := file[:i], file[i+1:]
+	vers, err := module.DecodeVersion(encVers)
+	if err != nil {
+		fmt.Fprintf(os.Stderr, "go proxy_test: %v", err)
+		http.NotFound(w, r)
+		return
+	}
 
 	if codehost.AllHex(vers) {
 		var best string
@@ -239,9 +250,14 @@
 		fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
 		return nil
 	}
+	encVers, err := module.EncodeVersion(vers)
+	if err != nil {
+		fmt.Fprintf(os.Stderr, "go proxy: %v\n", err)
+		return nil
+	}
 
 	prefix := strings.Replace(enc, "/", "_", -1)
-	name := filepath.Join(cmdGoDir, "testdata/mod", prefix+"_"+vers+".txt")
+	name := filepath.Join(cmdGoDir, "testdata/mod", prefix+"_"+encVers+".txt")
 	a := archiveCache.Do(name, func() interface{} {
 		a, err := txtar.ParseFile(name)
 		if err != nil {
diff --git a/vendor/cmd/go/script_test.go b/vendor/cmd/go/script_test.go
index 1343638..4f4c26a 100644
--- a/vendor/cmd/go/script_test.go
+++ b/vendor/cmd/go/script_test.go
@@ -85,8 +85,9 @@
 	ts.cd = filepath.Join(ts.workdir, "gopath/src")
 	ts.env = []string{
 		"WORK=" + ts.workdir, // must be first for ts.abbrev
-		"PATH=" + os.Getenv("PATH"),
+		"PATH=" + testBin + string(filepath.ListSeparator) + os.Getenv("PATH"),
 		homeEnvName() + "=/no-home",
+		"CCACHE_DISABLE=1", // ccache breaks with non-existent HOME
 		"GOARCH=" + runtime.GOARCH,
 		"GOCACHE=" + testGOCACHE,
 		"GOOS=" + runtime.GOOS,
@@ -95,6 +96,11 @@
 		"GOROOT=" + testGOROOT,
 		tempEnvName() + "=" + filepath.Join(ts.workdir, "tmp"),
 		"devnull=" + os.DevNull,
+		":=" + string(os.PathListSeparator),
+	}
+
+	if runtime.GOOS == "plan9" {
+		ts.env = append(ts.env, "path="+testBin+string(filepath.ListSeparator)+os.Getenv("path"))
 	}
 
 	if runtime.GOOS == "windows" {
@@ -701,7 +707,7 @@
 // exec runs the given command line (an actual subprocess, not simulated)
 // in ts.cd with environment ts.env and then returns collected standard output and standard error.
 func (ts *testScript) exec(command string, args ...string) (stdout, stderr string, err error) {
-	cmd := exec.Command(testGo, args...)
+	cmd := exec.Command(command, args...)
 	cmd.Dir = ts.cd
 	cmd.Env = append(ts.env, "PWD="+ts.cd)
 	var stdoutBuf, stderrBuf strings.Builder
diff --git a/vendor/cmd/go/testdata/addmod.go b/vendor/cmd/go/testdata/addmod.go
index 16dca0e..19850af 100644
--- a/vendor/cmd/go/testdata/addmod.go
+++ b/vendor/cmd/go/testdata/addmod.go
@@ -97,13 +97,13 @@
 			continue
 		}
 		path, vers, dir := f[0], f[1], f[2]
-		mod, err := ioutil.ReadFile(filepath.Join(gopath, "src/mod/cache/download", path, "@v", vers+".mod"))
+		mod, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".mod"))
 		if err != nil {
 			log.Printf("%s: %v", arg, err)
 			exitCode = 1
 			continue
 		}
-		info, err := ioutil.ReadFile(filepath.Join(gopath, "src/mod/cache/download", path, "@v", vers+".info"))
+		info, err := ioutil.ReadFile(filepath.Join(gopath, "pkg/mod/cache/download", path, "@v", vers+".info"))
 		if err != nil {
 			log.Printf("%s: %v", arg, err)
 			exitCode = 1
diff --git a/vendor/cmd/go/testdata/mod/golang.org_notx_useinternal_v0.1.0.txt b/vendor/cmd/go/testdata/mod/golang.org_notx_useinternal_v0.1.0.txt
new file mode 100644
index 0000000..0420a1a
--- /dev/null
+++ b/vendor/cmd/go/testdata/mod/golang.org_notx_useinternal_v0.1.0.txt
@@ -0,0 +1,13 @@
+written by hand — attempts to use a prohibited internal package
+(https://golang.org/s/go14internal)
+
+-- .mod --
+module golang.org/notx/useinternal
+-- .info --
+{"Version":"v0.1.0","Name":"","Short":"","Time":"2018-07-25T17:24:00Z"}
+-- go.mod --
+module golang.org/notx/useinternal
+-- useinternal.go --
+package useinternal
+
+import _ "golang.org/x/internal/subtle"
diff --git a/vendor/cmd/go/testdata/mod/golang.org_x_internal_v0.1.0.txt b/vendor/cmd/go/testdata/mod/golang.org_x_internal_v0.1.0.txt
new file mode 100644
index 0000000..5737e95
--- /dev/null
+++ b/vendor/cmd/go/testdata/mod/golang.org_x_internal_v0.1.0.txt
@@ -0,0 +1,43 @@
+written by hand — loosely derived from golang.org/x/crypto/internal/subtle,
+but splitting the internal package across a module boundary
+
+-- .mod --
+module golang.org/x/internal
+-- .info --
+{"Version":"v0.1.0","Name":"","Short":"","Time":"2018-07-25T17:24:00Z"}
+-- go.mod --
+module golang.org/x/internal
+-- subtle/aliasing.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !appengine
+
+// This is a tiny version of golang.org/x/crypto/internal/subtle.
+
+package subtle
+
+import "unsafe"
+
+func AnyOverlap(x, y []byte) bool {
+	return len(x) > 0 && len(y) > 0 &&
+		uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
+		uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
+}
+-- subtle/aliasing_appengine.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build appengine
+
+package subtle
+
+import "reflect"
+
+func AnyOverlap(x, y []byte) bool {
+	return len(x) > 0 && len(y) > 0 &&
+		reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
+		reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
+}
diff --git a/vendor/cmd/go/testdata/mod/golang.org_x_useinternal_v0.1.0.txt b/vendor/cmd/go/testdata/mod/golang.org_x_useinternal_v0.1.0.txt
new file mode 100644
index 0000000..3fcba44
--- /dev/null
+++ b/vendor/cmd/go/testdata/mod/golang.org_x_useinternal_v0.1.0.txt
@@ -0,0 +1,13 @@
+written by hand — uses an internal package from another module
+(https://golang.org/s/go14internal)
+
+-- .mod --
+module golang.org/x/useinternal
+-- .info --
+{"Version":"v0.1.0","Name":"","Short":"","Time":"2018-07-25T17:24:00Z"}
+-- go.mod --
+module golang.org/x/useinternal
+-- useinternal.go --
+package useinternal
+
+import _ "golang.org/x/internal/subtle"
diff --git "a/vendor/cmd/go/testdata/mod/rsc.io_\041c\041g\041o_v1.0.0.txt" "b/vendor/cmd/go/testdata/mod/rsc.io_\041c\041g\041o_v1.0.0.txt"
new file mode 100644
index 0000000..6276147
--- /dev/null
+++ "b/vendor/cmd/go/testdata/mod/rsc.io_\041c\041g\041o_v1.0.0.txt"
@@ -0,0 +1,19 @@
+rsc.io/CGO v1.0.0
+
+-- .mod --
+module rsc.io/CGO
+-- .info --
+{"Version":"v1.0.0","Name":"","Short":"","Time":"2018-08-01T18:23:45Z"}
+-- go.mod --
+module rsc.io/CGO
+-- cgo.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package CGO
+
+// #cgo CFLAGS: -I${SRCDIR}
+import "C"
+
+var V = 0
diff --git "a/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.2.txt" "b/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.2.txt"
index 177f077..21185c3 100644
--- "a/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.2.txt"
+++ "b/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.2.txt"
@@ -1,4 +1,4 @@
-rsc.io/quote@v2.0.0 && cp mod/rsc.io_quote_v0.0.0-20180709153244-fd906ed3b100.txt mod/rsc.io_quote_v2.0.0.txt
+rsc.io/QUOTE v1.5.2
 
 -- .mod --
 module rsc.io/QUOTE
diff --git "a/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.3-\041p\041r\041e.txt" "b/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.3-\041p\041r\041e.txt"
new file mode 100644
index 0000000..54bac2d
--- /dev/null
+++ "b/vendor/cmd/go/testdata/mod/rsc.io_\041q\041u\041o\041t\041e_v1.5.3-\041p\041r\041e.txt"
@@ -0,0 +1,88 @@
+rsc.io/QUOTE v1.5.3-PRE (sigh)
+
+-- .mod --
+module rsc.io/QUOTE
+
+require rsc.io/quote v1.5.2
+-- .info --
+{"Version":"v1.5.3-PRE","Name":"","Short":"","Time":"2018-07-15T16:25:34Z"}
+-- go.mod --
+module rsc.io/QUOTE
+
+require rsc.io/quote v1.5.2
+-- QUOTE/quote.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// PACKAGE QUOTE COLLECTS LOUD SAYINGS.
+package QUOTE
+
+import (
+	"strings"
+
+	"rsc.io/quote"
+)
+
+// HELLO RETURNS A GREETING.
+func HELLO() string {
+	return strings.ToUpper(quote.Hello())
+}
+
+// GLASS RETURNS A USEFUL PHRASE FOR WORLD TRAVELERS.
+func GLASS() string {
+	return strings.ToUpper(quote.GLASS())
+}
+
+// GO RETURNS A GO PROVERB.
+func GO() string {
+	return strings.ToUpper(quote.GO())
+}
+
+// OPT RETURNS AN OPTIMIZATION TRUTH.
+func OPT() string {
+	return strings.ToUpper(quote.OPT())
+}
+-- QUOTE/quote_test.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package QUOTE
+
+import (
+	"os"
+	"testing"
+)
+
+func init() {
+	os.Setenv("LC_ALL", "en")
+}
+
+func TestHELLO(t *testing.T) {
+	hello := "HELLO, WORLD"
+	if out := HELLO(); out != hello {
+		t.Errorf("HELLO() = %q, want %q", out, hello)
+	}
+}
+
+func TestGLASS(t *testing.T) {
+	glass := "I CAN EAT GLASS AND IT DOESN'T HURT ME."
+	if out := GLASS(); out != glass {
+		t.Errorf("GLASS() = %q, want %q", out, glass)
+	}
+}
+
+func TestGO(t *testing.T) {
+	go1 := "DON'T COMMUNICATE BY SHARING MEMORY, SHARE MEMORY BY COMMUNICATING."
+	if out := GO(); out != go1 {
+		t.Errorf("GO() = %q, want %q", out, go1)
+	}
+}
+
+func TestOPT(t *testing.T) {
+	opt := "IF A PROGRAM IS TOO SLOW, IT MUST HAVE A LOOP."
+	if out := OPT(); out != opt {
+		t.Errorf("OPT() = %q, want %q", out, opt)
+	}
+}
diff --git a/vendor/cmd/go/testdata/mod/rsc.io_badmod_v1.0.0.txt b/vendor/cmd/go/testdata/mod/rsc.io_badmod_v1.0.0.txt
new file mode 100644
index 0000000..993ceb7
--- /dev/null
+++ b/vendor/cmd/go/testdata/mod/rsc.io_badmod_v1.0.0.txt
@@ -0,0 +1,11 @@
+rsc.io/badmod v1.0.0
+written by hand
+
+-- .mod --
+module rsc.io/badmod
+hello world
+-- .info --
+{"Version":"v1.0.0"}
+-- x.go --
+package x
+
diff --git a/vendor/cmd/go/testdata/mod/rsc.io_quote_v2.0.0.txt b/vendor/cmd/go/testdata/mod/rsc.io_quote_v2.0.0.txt
index 2f687f5..e461ed4 100644
--- a/vendor/cmd/go/testdata/mod/rsc.io_quote_v2.0.0.txt
+++ b/vendor/cmd/go/testdata/mod/rsc.io_quote_v2.0.0.txt
@@ -1,4 +1,4 @@
-rsc.io/quote@v2.0.0 && cp mod/rsc.io_quote_v0.0.0-20180709153244-fd906ed3b100.txt mod/rsc.io_quote_v2.0.0.txt
+rsc.io/quote@v2.0.0
 
 -- .mod --
 module "rsc.io/quote"
diff --git a/vendor/cmd/go/testdata/script/README b/vendor/cmd/go/testdata/script/README
index 0418bc9..a80233b 100644
--- a/vendor/cmd/go/testdata/script/README
+++ b/vendor/cmd/go/testdata/script/README
@@ -149,7 +149,7 @@
 multi-phase script with a bug in it:
 
 	# GOPATH with p1 in d2, p2 in d2
-	env GOPATH=$WORK/d1:$WORK/d2
+	env GOPATH=$WORK/d1${:}$WORK/d2
 
 	# build & install p1
 	env
diff --git a/vendor/cmd/go/testdata/script/binary_only.txt b/vendor/cmd/go/testdata/script/binary_only.txt
new file mode 100644
index 0000000..397904e
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/binary_only.txt
@@ -0,0 +1,10 @@
+# check that error for missing binary-only says where it should be
+! go build b
+stderr pkg[\\/].*a\.a
+
+-- a/a.go --
+//go:binary-only-package
+
+package a
+-- b/b.go --
+package b; import "a"
diff --git a/vendor/cmd/go/testdata/script/goflags.txt b/vendor/cmd/go/testdata/script/goflags.txt
new file mode 100644
index 0000000..20de325
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/goflags.txt
@@ -0,0 +1,49 @@
+# GOFLAGS sets flags for commands
+
+env GOFLAGS='-e -f={{.Dir}} --test.benchtime=1s -count=10'
+go list asdfasdfasdf  # succeeds because of -e
+go list runtime
+stdout '[\\/]runtime$'
+
+env GOFLAGS=-race OLDGOARCH=$GOARCH OLDGOOS=$GOOS GOARCH=386 GOOS=linux
+! go list runtime
+stderr 'race is only supported on'
+
+env GOARCH=$OLDGOARCH GOOS=$OLDGOOS
+
+# go env succeeds even though -f={{.Dir}} is inappropriate
+go env
+
+# bad flags are diagnosed
+env GOFLAGS=-typoflag
+! go list runtime
+stderr 'unknown flag -typoflag'
+
+env GOFLAGS=-
+! go list runtime
+stderr '^go: parsing \$GOFLAGS: non-flag "-"'
+
+env GOFLAGS=--
+! go list runtime
+stderr '^go: parsing \$GOFLAGS: non-flag "--"'
+
+env GOFLAGS=---oops
+! go list runtime
+stderr '^go: parsing \$GOFLAGS: non-flag "---oops"'
+
+env GOFLAGS=-=noname
+! go list runtime
+stderr '^go: parsing \$GOFLAGS: non-flag "-=noname"'
+
+env GOFLAGS=-f
+! go list runtime
+stderr '^go: flag needs an argument: -f \(from (\$GOFLAGS|%GOFLAGS%)\)$'
+
+env GOFLAGS=-e=asdf
+! go list runtime
+stderr '^go: invalid boolean value \"asdf\" for flag -e \(from (\$GOFLAGS|%GOFLAGS%)\)'
+
+# except in go bug (untested) and go env
+go env
+stdout GOFLAGS
+
diff --git a/vendor/cmd/go/testdata/script/help.txt b/vendor/cmd/go/testdata/script/help.txt
new file mode 100644
index 0000000..cbbd154
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/help.txt
@@ -0,0 +1,30 @@
+# go help shows overview.
+go help
+stdout 'Go is a tool'
+stdout 'bug.*start a bug report'
+
+# go help bug shows usage for bug
+go help bug
+stdout 'usage: go bug'
+stdout 'bug report'
+
+# go bug help is an error (bug takes no arguments)
+! go bug help
+stderr 'bug takes no arguments'
+
+# go help mod shows mod subcommands
+go help mod
+stdout 'go mod <command>'
+stdout tidy
+
+# go help mod tidy explains tidy
+go help mod tidy
+stdout 'usage: go mod tidy'
+
+# go mod help tidy does too
+go mod help tidy
+stdout 'usage: go mod tidy'
+
+# go mod --help doesn't print help but at least suggests it.
+! go mod --help
+stderr 'Run ''go help mod'' for usage.'
diff --git a/vendor/cmd/go/testdata/script/install_rebuild_gopath.txt b/vendor/cmd/go/testdata/script/install_rebuild_gopath.txt
index 568249b..d42b070 100644
--- a/vendor/cmd/go/testdata/script/install_rebuild_gopath.txt
+++ b/vendor/cmd/go/testdata/script/install_rebuild_gopath.txt
@@ -1,6 +1,5 @@
 # GOPATH with p1 in d1, p2 in d2
-[!windows] env GOPATH=$WORK/d1:$WORK/d2
-[windows]  env GOPATH=$WORK/d1;$WORK/d2
+env GOPATH=$WORK/d1${:}$WORK/d2
 
 # build & install p1
 go install -i p1
diff --git a/vendor/cmd/go/testdata/script/list_find.txt b/vendor/cmd/go/testdata/script/list_find.txt
new file mode 100644
index 0000000..dbe8fb0
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/list_find.txt
@@ -0,0 +1,10 @@
+# go list -find should not report imports
+
+go list -f {{.Incomplete}} x/y/z...  # should probably exit non-zero but never has
+stdout true
+go list -find -f '{{.Incomplete}} {{.Imports}}' x/y/z...
+stdout '^false \[\]'
+
+-- x/y/z/z.go --
+package z
+import "does/not/exist"
diff --git a/vendor/cmd/go/testdata/script/list_test_e.txt b/vendor/cmd/go/testdata/script/list_test_e.txt
new file mode 100644
index 0000000..f147332
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/list_test_e.txt
@@ -0,0 +1,9 @@
+# issue 25980: crash in go list -e -test
+go list -e -test -f '{{.Error}}' p
+stdout '^p[/\\]d_test.go:2:8: cannot find package "d" in any of:'
+
+-- p/d.go --
+package d
+-- p/d_test.go --
+package d_test
+import _ "d"
diff --git a/vendor/cmd/go/testdata/script/mod_case.txt b/vendor/cmd/go/testdata/script/mod_case.txt
index db21c13..ee818c2 100644
--- a/vendor/cmd/go/testdata/script/mod_case.txt
+++ b/vendor/cmd/go/testdata/script/mod_case.txt
@@ -9,5 +9,12 @@
 stdout 'DEPS.*rsc.io/quote'
 stdout 'DIR.*!q!u!o!t!e'
 
+go get rsc.io/QUOTE@v1.5.3-PRE
+go list -m all
+stdout '^rsc.io/QUOTE v1.5.3-PRE'
+
+go list -f '{{.Dir}}' rsc.io/QUOTE/QUOTE
+stdout '!q!u!o!t!e@v1.5.3-!p!r!e'
+
 -- go.mod --
 module x
diff --git a/vendor/cmd/go/testdata/script/mod_case_cgo.txt b/vendor/cmd/go/testdata/script/mod_case_cgo.txt
new file mode 100644
index 0000000..917bce9
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_case_cgo.txt
@@ -0,0 +1,9 @@
+[!cgo] skip
+
+env GO111MODULE=on
+
+go get rsc.io/CGO
+go build rsc.io/CGO
+
+-- go.mod --
+module x
diff --git a/vendor/cmd/go/testdata/script/mod_doc.txt b/vendor/cmd/go/testdata/script/mod_doc.txt
new file mode 100644
index 0000000..223283d
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_doc.txt
@@ -0,0 +1,34 @@
+# go doc should find module documentation
+
+env GO111MODULE=on
+
+go doc y
+stdout 'Package y is.*alphabet'
+stdout 'import "x/y"'
+go doc x/y
+stdout 'Package y is.*alphabet'
+! go doc quote.Hello
+stderr 'doc: symbol quote is not a type' # because quote is not in local cache
+go list rsc.io/quote # now it is
+go doc quote.Hello
+stdout 'Hello returns a greeting'
+go doc quote
+stdout 'Package quote collects pithy sayings.'
+
+# Double-check go doc y when y is not in GOPATH/src.
+env GOPATH=$WORK/altgopath
+go doc x/y
+stdout 'Package y is.*alphabet'
+go doc y
+stdout 'Package y is.*alphabet'
+
+-- go.mod --
+module x
+require rsc.io/quote v1.5.2
+
+-- y/y.go --
+// Package y is the next to last package of the alphabet.
+package y
+
+-- x.go --
+package x
diff --git a/vendor/cmd/go/testdata/script/mod_edit.txt b/vendor/cmd/go/testdata/script/mod_edit.txt
index 920f34a..60a6f74 100644
--- a/vendor/cmd/go/testdata/script/mod_edit.txt
+++ b/vendor/cmd/go/testdata/script/mod_edit.txt
@@ -3,41 +3,43 @@
 # Test that go mod edits and related mod flags work.
 # Also test that they can use a dummy name that isn't resolvable. golang.org/issue/24100
 
-# go mod -init
-! go mod -init
+# go mod init
+! go mod init
 stderr 'cannot determine module path'
 ! exists go.mod
 
-go mod -init -module x.x/y/z
+go mod init x.x/y/z
 stderr 'creating new go.mod: module x.x/y/z'
 cmp go.mod $WORK/go.mod.init
 
-! go mod -init
+! go mod init
 cmp go.mod $WORK/go.mod.init
 
 # go mod edits
-go mod -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z'
+go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z'
 cmp go.mod $WORK/go.mod.edit1
-go mod -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0
+go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0
 cmp go.mod $WORK/go.mod.edit2
 
-# go mod -json
-go mod -json
+# go mod edit -json
+go mod edit -json
 cmp stdout $WORK/go.mod.json
 
-# go mod -replace
-go mod -replace=x.1@v1.3.0=y.1/v2@v2.3.5 -replace=x.1@v1.4.0=y.1/v2@v2.3.5
+# go mod edit -replace
+go mod edit -replace=x.1@v1.3.0=y.1/v2@v2.3.5 -replace=x.1@v1.4.0=y.1/v2@v2.3.5
 cmp go.mod $WORK/go.mod.edit3
-go mod -replace=x.1=y.1/v2@v2.3.6
+go mod edit -replace=x.1=y.1/v2@v2.3.6
 cmp go.mod $WORK/go.mod.edit4
+go mod edit -dropreplace=x.1
+cmp go.mod $WORK/go.mod.edit5
 
-# go mod -packages
-go mod -packages
-cmp stdout $WORK/go.mod.packages
-
-# go mod -fmt
+# go mod edit -fmt
 cp $WORK/go.mod.badfmt go.mod
-go mod -fmt
+go mod edit -fmt -print # -print should avoid writing file
+cmp stdout $WORK/go.mod.edit4
+cmp go.mod $WORK/go.mod.badfmt
+go mod edit -fmt # without -print, should write file (and nothing to stdout)
+! stdout .
 cmp go.mod $WORK/go.mod.edit4
 
 -- x.go --
@@ -118,9 +120,12 @@
 replace x.1 => y.1/v2 v2.3.6
 
 require x.3 v1.99.0
--- $WORK/go.mod.packages --
-x.x/y/z
-x.x/y/z/w
+-- $WORK/go.mod.edit5 --
+module x.x/y/z
+
+exclude x.1 v1.2.0
+
+require x.3 v1.99.0
 -- $WORK/go.mod.badfmt --
 module     x.x/y/z
 
diff --git a/vendor/cmd/go/testdata/script/mod_enabled.txt b/vendor/cmd/go/testdata/script/mod_enabled.txt
index 189d4ed..4901b9c 100644
--- a/vendor/cmd/go/testdata/script/mod_enabled.txt
+++ b/vendor/cmd/go/testdata/script/mod_enabled.txt
@@ -4,6 +4,8 @@
 cd $GOPATH/src/x/y/z
 go env GOMOD
 ! stdout . # no non-empty lines
+! go list -m -f {{.GoMod}}
+stderr 'not using modules'
 
 cd $GOPATH/src/x/y/z/w
 go env GOMOD
@@ -16,6 +18,8 @@
 cd $GOPATH/foo
 go env GOMOD
 stdout foo[/\\]go.mod
+go list -m -f {{.GoMod}}
+stdout foo[/\\]go.mod
 
 cd $GOPATH/foo/bar/baz
 go env GOMOD
@@ -33,8 +37,10 @@
 stdout z[/\\]go.mod
 
 cd $GOPATH/src/x/y
-! go env GOMOD
-stderr 'cannot find main module root'
+go env GOMOD
+! stdout .
+! go list -m
+stderr 'cannot find main module'
 
 cd $GOPATH/foo
 go env GOMOD
diff --git a/vendor/cmd/go/testdata/script/mod_file_proxy.txt b/vendor/cmd/go/testdata/script/mod_file_proxy.txt
index 144d06a..8de6d7d 100644
--- a/vendor/cmd/go/testdata/script/mod_file_proxy.txt
+++ b/vendor/cmd/go/testdata/script/mod_file_proxy.txt
@@ -1,24 +1,21 @@
-# Use download cache for -getmode=local.
+# Allow (cached) downloads for -mod=readonly.
 env GO111MODULE=on
 env GOPATH=$WORK/gopath1
 cd $WORK/x
-! go list -getmode=local
-go list
-go list -getmode=local
+go mod edit -fmt
+go list -mod=readonly
 env GOPROXY=file:///nonexist
-go list -getmode=local
-grep v1.5.1 $GOPATH/src/mod/cache/download/rsc.io/quote/@v/list
+go list
+grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
 
 # Use download cache as file:/// proxy.
 [windows] stop # TODO: file://$WORK puts backslashes in the URL
 env GOPATH=$WORK/gopath2
 env GOPROXY=file:///nonexist
-! go list -getmode=local
 ! go list
-env GOPROXY=file://$WORK/gopath1/src/mod/cache/download
-! go list -getmode=local
+env GOPROXY=file://$WORK/gopath1/pkg/mod/cache/download
 go list
-grep v1.5.1 $GOPATH/src/mod/cache/download/rsc.io/quote/@v/list
+grep v1.5.1 $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/list
 
 -- $WORK/x/go.mod --
 module x
diff --git a/vendor/cmd/go/testdata/script/mod_find.txt b/vendor/cmd/go/testdata/script/mod_find.txt
index 9f4393d..f4ac8d0 100644
--- a/vendor/cmd/go/testdata/script/mod_find.txt
+++ b/vendor/cmd/go/testdata/script/mod_find.txt
@@ -1,45 +1,45 @@
 # Derive module path from import comment.
 cd $WORK/x
 exists x.go
-go mod -init
+go mod init
 stderr 'module x'
 
 # Import comment works even with CRLF line endings.
 rm go.mod
 addcrlf x.go
-go mod -init
+go mod init
 stderr 'module x'
 
 # go mod should die in GOPATH if modules are not enabled for GOPATH
 cd $GOPATH/src/example.com/x/y
-! go mod -init
+! go mod init
 stderr 'go: modules disabled inside GOPATH/src by GO111MODULE=auto; see ''go help modules'''
 
 env GO111MODULE=on
 
 # Derive module path from location inside GOPATH.
 cd $GOPATH/src/example.com/x/y
-go mod -init
+go mod init
 stderr 'module example.com/x/y$'
 rm go.mod
 
 # Module path from Godeps/Godeps.json overrides GOPATH.
 cd $GOPATH/src/example.com/x/y/z
-go mod -init
+go mod init
 stderr 'unexpected.com/z'
 rm go.mod
 
 # Empty directory outside GOPATH fails.
 mkdir $WORK/empty
 cd $WORK/empty
-! go mod -init
+! go mod init
 stderr 'cannot determine module path for source directory'
 rm go.mod
 
 # Empty directory inside GOPATH/src uses location inside GOPATH.
 mkdir $GOPATH/src/empty
 cd $GOPATH/src/empty
-go mod -init
+go mod init
 stderr 'empty'
 rm go.mod
 
@@ -48,37 +48,37 @@
 # gplink1/src/empty where gopathlink -> GOPATH
 symlink $WORK/gopathlink -> gopath
 cd $WORK/gopathlink/src/empty
-go mod -init
+go mod init
 rm go.mod
 
 # GOPATH/src/link where link -> out of GOPATH
 symlink $GOPATH/src/link -> $WORK/empty
 cd $WORK/empty
-! go mod -init
+! go mod init
 cd $GOPATH/src/link
-go mod -init
+go mod init
 stderr link
 rm go.mod
 
 # GOPATH/src/empty where GOPATH itself is a symlink
 env GOPATH=$WORK/gopathlink
 cd $GOPATH/src/empty
-go mod -init
+go mod init
 rm go.mod
 cd $WORK/gopath/src/empty
-go mod -init
+go mod init
 rm go.mod
 
 # GOPATH/src/link where GOPATH and link are both symlinks
 cd $GOPATH/src/link
-go mod -init
+go mod init
 stderr link
 rm go.mod
 
 # Too hard: doesn't match unevaluated nor completely evaluated. (Only partially evaluated.)
 # Whether this works depends on which OS we are running on.
 # cd $WORK/gopath/src/link
-# ! go mod -init
+# ! go mod init
 
 -- $WORK/x/x.go --
 package x // import "x"
diff --git a/vendor/cmd/go/testdata/script/mod_get_commit.txt b/vendor/cmd/go/testdata/script/mod_get_commit.txt
index 4657671..97a1078 100644
--- a/vendor/cmd/go/testdata/script/mod_get_commit.txt
+++ b/vendor/cmd/go/testdata/script/mod_get_commit.txt
@@ -32,12 +32,12 @@
 go get rsc.io/quote@23179ee8
 grep 'rsc.io/quote v1.5.1' go.mod
 
-# go mod -require does not interpret commits
-go mod -require rsc.io/quote@23179ee
+# go mod edit -require does not interpret commits
+go mod edit -require rsc.io/quote@23179ee
 grep 'rsc.io/quote 23179ee' go.mod
 
-# but go mod -fix fixes them
-go mod -fix
+# but go mod fix fixes them
+go mod fix
 grep 'rsc.io/quote v1.5.1' go.mod
 
 -- go.mod --
diff --git a/vendor/cmd/go/testdata/script/mod_get_downgrade.txt b/vendor/cmd/go/testdata/script/mod_get_downgrade.txt
index e687403..ac814da 100644
--- a/vendor/cmd/go/testdata/script/mod_get_downgrade.txt
+++ b/vendor/cmd/go/testdata/script/mod_get_downgrade.txt
@@ -11,8 +11,29 @@
 go list -m all
 stdout 'rsc.io/quote v1.3.0'
 
+# downgrade should report inconsistencies and not change go.mod
+go get rsc.io/quote@v1.5.1
+go list -m all
+stdout 'rsc.io/quote v1.5.1'
+stdout 'rsc.io/sampler v1.3.0'
+! go get rsc.io/sampler@v1.0.0 rsc.io/quote@v1.5.2 golang.org/x/text@none
+stderr 'go get: inconsistent versions:\n\trsc.io/quote@v1.5.2 requires golang.org/x/text@v0.0.0-20170915032832-14c0d48ead0c \(not golang.org/x/text@none\), rsc.io/sampler@v1.3.0 \(not rsc.io/sampler@v1.0.0\)'
+go list -m all
+stdout 'rsc.io/quote v1.5.1'
+stdout 'rsc.io/sampler v1.3.0'
+
+# go get -u args should limit upgrades
+cp go.mod.empty go.mod
+go get -u rsc.io/quote@v1.4.0 rsc.io/sampler@v1.0.0
+go list -m all
+stdout 'rsc.io/quote v1.4.0'
+stdout 'rsc.io/sampler v1.0.0'
+! stdout golang.org/x/text
+
 -- go.mod --
 module x
 require rsc.io/quote v1.5.1
+-- go.mod.empty --
+module x
 -- x.go --
 package x
diff --git a/vendor/cmd/go/testdata/script/mod_get_indirect.txt b/vendor/cmd/go/testdata/script/mod_get_indirect.txt
index f4ee5bf..8388ed1 100644
--- a/vendor/cmd/go/testdata/script/mod_get_indirect.txt
+++ b/vendor/cmd/go/testdata/script/mod_get_indirect.txt
@@ -17,15 +17,15 @@
 grep 'rsc.io/quote v1.5.2$' go.mod
 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
 
-# indirect tag should be added by go mod -sync
+# indirect tag should be added by go mod tidy
 cp $WORK/tmp/usequote.go x.go
-go mod -sync
+go mod tidy
 grep 'rsc.io/quote v1.5.2$' go.mod
 grep 'golang.org/x/text [v0-9a-f\.-]+ // indirect' go.mod
 
 # requirement should be dropped entirely if not needed
 cp $WORK/tmp/usetext.go x.go
-go mod -sync
+go mod tidy
 ! grep rsc.io/quote go.mod
 grep 'golang.org/x/text [v0-9a-f\.-]+$' go.mod
 
diff --git a/vendor/cmd/go/testdata/script/mod_getmode_vendor.txt b/vendor/cmd/go/testdata/script/mod_getmode_vendor.txt
index 861e91c..3dd8d1b 100644
--- a/vendor/cmd/go/testdata/script/mod_getmode_vendor.txt
+++ b/vendor/cmd/go/testdata/script/mod_getmode_vendor.txt
@@ -1,19 +1,19 @@
 env GO111MODULE=on
 
 go get -m rsc.io/quote@v1.5.1
-go mod -vendor
+go mod vendor
 env GOPATH=$WORK/empty
 env GOPROXY=file:///nonexist
 
-go list -getmode=vendor
-go list -getmode=vendor -m -f '{{.Path}} {{.Version}} {{.Dir}}' all
+go list -mod=vendor
+go list -mod=vendor -m -f '{{.Path}} {{.Version}} {{.Dir}}' all
 stdout '^rsc.io/quote v1.5.1 .*vendor[\\/]rsc.io[\\/]quote$'
 stdout '^golang.org/x/text v0.0.0.* .*vendor[\\/]golang.org[\\/]x[\\/]text$'
 
-! go list -getmode=vendor -m rsc.io/quote@latest
-stderr 'module lookup disabled by -getmode=vendor'
-! go get -getmode=vendor -u
-stderr 'go get: disabled by -getmode=vendor'
+! go list -mod=vendor -m rsc.io/quote@latest
+stderr 'module lookup disabled by -mod=vendor'
+! go get -mod=vendor -u
+stderr 'go get: disabled by -mod=vendor'
 
 -- go.mod --
 module x
diff --git a/vendor/cmd/go/testdata/script/mod_go_version.txt b/vendor/cmd/go/testdata/script/mod_go_version.txt
new file mode 100644
index 0000000..f2de74c
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_go_version.txt
@@ -0,0 +1,61 @@
+# Test support for declaring needed Go version in module.
+
+env GO111MODULE=on
+
+go list
+! go build
+stderr 'module requires Go 1.999'
+go build sub.1
+! go build badsub.1
+stderr 'module requires Go 1.11111'
+
+go build versioned.1
+go mod edit -require versioned.1@v1.1.0
+! go build versioned.1
+stderr 'module requires Go 1.99999'
+
+-- go.mod --
+module m
+go 1.999
+require (
+	sub.1 v1.0.0
+	badsub.1 v1.0.0
+	versioned.1 v1.0.0
+)
+replace (
+	sub.1 => ./sub
+	badsub.1 => ./badsub
+	versioned.1 v1.0.0 => ./versioned1
+	versioned.1 v1.1.0 => ./versioned2
+)
+
+-- x.go --
+package x
+
+-- sub/go.mod --
+module m
+go 1.11
+
+-- sub/x.go --
+package x
+
+-- badsub/go.mod --
+module m
+go 1.11111
+
+-- badsub/x.go --
+package x
+
+-- versioned1/go.mod --
+module versioned
+go 1.0
+
+-- versioned1/x.go --
+package x
+
+-- versioned2/go.mod --
+module versioned
+go 1.99999
+
+-- versioned2/x.go --
+package x
diff --git a/vendor/cmd/go/testdata/script/mod_gobuild_import.txt b/vendor/cmd/go/testdata/script/mod_gobuild_import.txt
new file mode 100644
index 0000000..932b8b6
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_gobuild_import.txt
@@ -0,0 +1,74 @@
+# go/build's Import should find modules by invoking the go command
+
+go build -o $WORK/testimport.exe ./testimport
+
+# GO111MODULE=off
+env GO111MODULE=off
+! exec $WORK/testimport.exe x/y/z/w .
+
+# GO111MODULE=auto in GOPATH/src
+env GO111MODULE=
+! exec $WORK/testimport.exe x/y/z/w .
+env GO111MODULE=auto
+! exec $WORK/testimport.exe x/y/z/w .
+
+# GO111MODULE=auto outside GOPATH/src
+cd $GOPATH/other
+env GO111MODULE=
+exec $WORK/testimport.exe other/x/y/z/w .
+stdout w2.go
+
+! exec $WORK/testimport.exe x/y/z/w .
+stderr 'cannot find module providing package x/y/z/w'
+
+cd z
+env GO111MODULE=auto
+exec $WORK/testimport.exe other/x/y/z/w .
+stdout w2.go
+
+# GO111MODULE=on outside GOPATH/src
+env GO111MODULE=on
+exec $WORK/testimport.exe other/x/y/z/w .
+stdout w2.go
+
+# GO111MODULE=on in GOPATH/src
+cd $GOPATH/src
+exec $WORK/testimport.exe x/y/z/w .
+stdout w1.go
+cd w
+exec $WORK/testimport.exe x/y/z/w ..
+stdout w1.go
+
+-- go.mod --
+module x/y/z
+
+-- z.go --
+package z
+
+-- w/w1.go --
+package w
+
+-- testimport/x.go --
+package main
+
+import (
+	"fmt"
+	"go/build"
+	"log"
+	"os"
+	"strings"
+)
+
+func main() {
+	p, err := build.Import(os.Args[1], os.Args[2], 0)
+	if err != nil {
+		log.Fatal(err)
+	}
+	fmt.Printf("%s\n%s\n", p.Dir, strings.Join(p.GoFiles, " "))
+}
+
+-- $GOPATH/other/go.mod --
+module other/x/y
+
+-- $GOPATH/other/z/w/w2.go --
+package w
diff --git a/vendor/cmd/go/testdata/script/mod_graph.txt b/vendor/cmd/go/testdata/script/mod_graph.txt
new file mode 100644
index 0000000..07968f5
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_graph.txt
@@ -0,0 +1,10 @@
+env GO111MODULE=on
+
+go mod graph
+stdout '^m rsc.io/quote@v1.5.2$'
+stdout '^rsc.io/quote@v1.5.2 rsc.io/sampler@v1.3.0$'
+! stdout '^m rsc.io/sampler@v1.3.0$'
+
+-- go.mod --
+module m
+require rsc.io/quote v1.5.2
diff --git a/vendor/cmd/go/testdata/script/mod_import_mod.txt b/vendor/cmd/go/testdata/script/mod_import_mod.txt
index 46f45c7..b035e3d 100644
--- a/vendor/cmd/go/testdata/script/mod_import_mod.txt
+++ b/vendor/cmd/go/testdata/script/mod_import_mod.txt
@@ -1,4 +1,4 @@
-# Test that GOPATH/src/mod is excluded
+# Test that GOPATH/pkg/mod is excluded
 env GO111MODULE=off
 ! go list mod/foo
 stderr 'disallowed import path'
diff --git a/vendor/cmd/go/testdata/script/mod_internal.txt b/vendor/cmd/go/testdata/script/mod_internal.txt
new file mode 100644
index 0000000..dfe8282
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_internal.txt
@@ -0,0 +1,82 @@
+env GO111MODULE=on
+
+# golang.org/x/internal should be importable from other golang.org/x modules.
+rm go.mod
+go mod init golang.org/x/anything
+go build .
+
+# ...but that should not leak into other modules.
+! go build ./baddep
+stderr 'use of internal package golang.org/x/.* not allowed in golang.org/notx/useinternal$'
+
+# Internal packages in the standard library should not leak into modules.
+! go build ./fromstd
+stderr 'use of internal package internal/testenv not allowed$'
+
+# Packages found via standard-library vendoring should not leak.
+! go build ./fromstdvendor
+stderr 'use of vendored package golang_org/x/net/http/httpguts not allowed$'
+
+
+# Dependencies should be able to use their own internal modules...
+rm go.mod
+go mod init golang.org/notx
+go build ./throughdep
+
+# ... but other modules should not, even if they have transitive dependencies.
+! go build .
+stderr 'use of internal package golang.org/x/.* not allowed in golang.org/notx$'
+
+# And transitive dependencies still should not leak.
+! go build ./baddep
+stderr 'use of internal package golang.org/x/.* not allowed in golang.org/notx/useinternal$'
+
+
+# Replacing an internal module should keep it internal to the same paths.
+rm go.mod
+go mod init golang.org/notx
+go mod edit -replace golang.org/x/internal=./replace/golang.org/notx/internal
+go build ./throughdep
+
+! go build ./baddep
+stderr 'use of internal package golang.org/x/.* not allowed in golang.org/notx/useinternal$'
+
+go mod edit -replace golang.org/x/internal=./vendor/golang.org/x/internal
+go build ./throughdep
+
+! go build ./baddep
+stderr 'use of internal package golang.org/x/.* not allowed in golang.org/notx/useinternal$'
+
+-- useinternal.go --
+package useinternal
+import _ "golang.org/x/internal/subtle"
+
+-- throughdep/useinternal.go --
+package throughdep
+import _ "golang.org/x/useinternal"
+
+-- baddep/useinternal.go --
+package baddep
+import _ "golang.org/notx/useinternal"
+
+-- fromstd/useinternal.go --
+package fromstd
+import _ "internal/testenv"
+
+-- fromstdvendor/useinternal.go --
+package fromstdvendor
+import _ "golang_org/x/net/http/httpguts"
+
+-- replace/golang.org/notx/internal/go.mod --
+module golang.org/x/internal
+
+-- replace/golang.org/notx/internal/subtle/subtle.go --
+package subtle
+// Ha ha! Nothing here!
+
+-- vendor/golang.org/x/internal/go.mod --
+module golang.org/x/internal
+
+-- vendor/golang.org/x/internal/subtle/subtle.go --
+package subtle
+// Ha ha! Nothing here!
diff --git a/vendor/cmd/go/testdata/script/mod_list.txt b/vendor/cmd/go/testdata/script/mod_list.txt
index 1597ebb..c9797ea 100644
--- a/vendor/cmd/go/testdata/script/mod_list.txt
+++ b/vendor/cmd/go/testdata/script/mod_list.txt
@@ -1,28 +1,28 @@
 env GO111MODULE=on
 
-# list {{.Dir}} shows main module but not not-yet-downloaded dependency
-go list -m -f '{{.Path}} {{.Main}} {{.Dir}}' all
-stdout '^x true .*[\\/]src$'
-stdout '^rsc.io/quote false $'
+# list {{.Dir}} shows main module and go.mod but not not-yet-downloaded dependency dir.
+go list -m -f '{{.Path}} {{.Main}} {{.GoMod}} {{.Dir}}' all
+stdout '^x true .*[\\/]src[\\/]go.mod .*[\\/]src$'
+stdout '^rsc.io/quote false .*[\\/]v1.5.2.mod $'
 
-# list {{.Dir}} shows dependency after download
-go list -f {{.Dir}} rsc.io/quote
-stdout 'mod[\\/]rsc.io[\\/]quote@v1.5.2'
+# list {{.Dir}} shows dependency after download (and go list without -m downloads it)
+go list -f '{{.Dir}}' rsc.io/quote
+stdout '.*mod[\\/]rsc.io[\\/]quote@v1.5.2$'
 
 # downloaded dependencies are read-only
-exists -readonly $GOPATH/src/mod/rsc.io/quote@v1.5.2
-exists -readonly $GOPATH/src/mod/rsc.io/quote@v1.5.2/buggy
+exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
+exists -readonly $GOPATH/pkg/mod/rsc.io/quote@v1.5.2/buggy
 
 # go clean -modcache can delete read-only dependencies
 go clean -modcache
-! exists $GOPATH/src/mod/rsc.io/quote@v1.5.2
+! exists $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
 
 # list {{.Dir}} shows replaced directories
 cp go.mod2 go.mod
 go list -f {{.Dir}} rsc.io/quote
-go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} => {{.Version}} {{.Dir}}{{end}}' all
+go list -m -f '{{.Path}} {{.Version}} {{.Dir}}{{with .Replace}} {{.GoMod}} => {{.Version}} {{.Dir}} {{.GoMod}}{{end}}' all
 stdout 'mod[\\/]rsc.io[\\/]quote@v1.5.1'
-stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 => v1.3.1.*sampler@v1.3.1'
+stdout 'v1.3.0.*mod[\\/]rsc.io[\\/]sampler@v1.3.1 .*[\\/]v1.3.1.mod => v1.3.1.*sampler@v1.3.1 .*[\\/]v1.3.1.mod'
 
 # list std should work
 go list std
diff --git a/vendor/cmd/go/testdata/script/mod_list_dir.txt b/vendor/cmd/go/testdata/script/mod_list_dir.txt
new file mode 100644
index 0000000..29cde71
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_list_dir.txt
@@ -0,0 +1,27 @@
+# go list with path to directory should work
+
+env GO111MODULE=off
+go list -f '{{.ImportPath}}' $GOROOT/src/math
+stdout ^math$
+
+env GO111MODULE=on
+go list -f '{{.ImportPath}}' $GOROOT/src/math
+stdout ^math$
+go list -f '{{.ImportPath}}' .
+stdout ^x$
+go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/quote@v1.5.2
+stdout '^rsc.io/quote$'
+go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0
+stdout '^rsc.io/sampler$'
+go get rsc.io/sampler@v1.3.1
+go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.1
+stdout '^rsc.io/sampler$'
+! go list -f '{{.ImportPath}}' $GOPATH/pkg/mod/rsc.io/sampler@v1.3.0
+stderr 'outside available modules'
+
+-- go.mod --
+module x
+require rsc.io/quote v1.5.2
+
+-- x.go --
+package x
diff --git a/vendor/cmd/go/testdata/script/mod_load_badmod.txt b/vendor/cmd/go/testdata/script/mod_load_badmod.txt
new file mode 100644
index 0000000..68c8b37
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_load_badmod.txt
@@ -0,0 +1,26 @@
+# Unknown lines should be ignored in dependency go.mod files.
+env GO111MODULE=on
+go list -m all
+
+# ... and in replaced dependency go.mod files.
+cp go.mod go.mod.usesub
+go list -m all
+
+# ... but not in the main module.
+cp go.mod.bad go.mod
+! go list -m all
+stderr 'unknown directive: hello'
+
+-- go.mod --
+module m
+require rsc.io/badmod v1.0.0
+-- go.mod.bad --
+module m
+hello world
+-- go.mod.usesub --
+module m
+require rsc.io/badmod v1.0.0
+replace rsc.io/badmod v1.0.0 => ./sub
+-- sub/go.mod --
+module sub
+hello world
diff --git a/vendor/cmd/go/testdata/script/mod_multirepo.txt b/vendor/cmd/go/testdata/script/mod_multirepo.txt
index 74d952c..7f977e8 100644
--- a/vendor/cmd/go/testdata/script/mod_multirepo.txt
+++ b/vendor/cmd/go/testdata/script/mod_multirepo.txt
@@ -2,25 +2,25 @@
 
 # initial standalone module should use no downloaded modules
 go list -deps -f {{.Dir}}
-! stdout 'src[\\/]mod'
+! stdout 'pkg[\\/]mod'
 
 # v2 import should use a downloaded module
 # both without an explicit go.mod entry ...
 cp tmp/use_v2.go x.go
 go list -deps -f {{.Dir}}
-stdout 'src[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
+stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
 
 # ... and with one ...
 cp tmp/use_v2.mod go.mod
 go list -deps -f {{.Dir}}
-stdout 'src[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
+stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
 
 # ... and even if there is a v2 module in a subdirectory.
 mkdir v2
 cp x.go v2/x.go
 cp tmp/v2.mod v2/go.mod
 go list -deps -f {{.Dir}}
-stdout 'src[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
+stdout 'pkg[\\/]mod[\\/]rsc.io[\\/]quote[\\/]v2@v2.0.1$'
 
 -- go.mod --
 module rsc.io/quote
diff --git a/vendor/cmd/go/testdata/script/mod_nomod.txt b/vendor/cmd/go/testdata/script/mod_nomod.txt
new file mode 100644
index 0000000..640d5a3
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_nomod.txt
@@ -0,0 +1,43 @@
+# Test go commands with no module.
+env GO111MODULE=on
+
+# go mod edit fails unless given explicit mod file argument
+! go mod edit -json
+go mod edit -json x.mod
+
+# bug succeeds
+[exec:echo] env BROWSER=echo
+[exec:echo] go bug
+
+# commands that load the package in the current directory fail
+! go build
+! go fmt
+! go generate
+! go get
+! go install
+! go list
+! go run x.go
+! go test
+! go vet
+
+# clean succeeds, even with -modcache
+go clean -modcache
+
+# doc succeeds for standard library
+go doc unsafe
+
+# env succeeds
+go env
+
+# tool succeeds
+go tool -n test2json
+
+# version succeeds
+go version
+
+-- x.mod --
+module m
+
+-- x.go --
+package main
+func main() {}
diff --git a/vendor/cmd/go/testdata/script/mod_readonly.txt b/vendor/cmd/go/testdata/script/mod_readonly.txt
new file mode 100644
index 0000000..5ae74a4
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_readonly.txt
@@ -0,0 +1,39 @@
+env GO111MODULE=on
+
+# -mod=readonly must not resolve missing modules nor update go.mod
+env GOFLAGS=-mod=readonly
+go mod edit -fmt
+cp go.mod go.mod.empty
+! go list
+stderr 'import lookup disabled by -mod=readonly'
+cmp go.mod go.mod.empty
+
+# update go.mod - go get allowed
+go get rsc.io/quote
+grep rsc.io/quote go.mod
+
+# update go.mod - go mod tidy allowed
+cp go.mod.empty go.mod
+go mod tidy
+
+# -mod=readonly must succeed once go.mod is up-to-date...
+go list
+
+# ... even if it needs downloads
+go clean -modcache
+go list
+
+# -mod=readonly should reject inconsistent go.mod files
+# (ones that would be rewritten).
+go mod edit -require rsc.io/sampler@v1.2.0
+cp go.mod go.mod.inconsistent
+! go list
+stderr 'go: updates to go.mod needed, disabled by -mod=readonly'
+cmp go.mod go.mod.inconsistent
+
+-- go.mod --
+module m
+
+-- x.go --
+package x
+import _ "rsc.io/quote"
diff --git a/vendor/cmd/go/testdata/script/mod_replace.txt b/vendor/cmd/go/testdata/script/mod_replace.txt
new file mode 100644
index 0000000..799a7e8
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_replace.txt
@@ -0,0 +1,87 @@
+env GO111MODULE=on
+
+go build -o a1.exe .
+exec ./a1.exe
+stdout 'Don''t communicate by sharing memory'
+
+# Modules can be replaced by local packages.
+go mod edit -replace=rsc.io/quote/v3=./local/rsc.io/quote/v3
+go build -o a2.exe .
+exec ./a2.exe
+stdout 'Concurrency is not parallelism.'
+
+# The module path of the replacement doesn't need to match.
+# (For example, it could be a long-running fork with its own import path.)
+go mod edit -replace=rsc.io/quote/v3=./local/not-rsc.io/quote/v3
+go build -o a3.exe .
+exec ./a3.exe
+stdout 'Clear is better than clever.'
+
+# However, the same module can't be used as two different paths.
+go mod edit -dropreplace=rsc.io/quote/v3 -replace=not-rsc.io/quote/v3@v3.0.0=rsc.io/quote/v3@v3.0.0 -require=not-rsc.io/quote/v3@v3.0.0
+! go build -o a4.exe .
+
+
+-- go.mod --
+module quoter
+
+require rsc.io/quote/v3 v3.0.0
+
+-- main.go --
+package main
+
+import (
+	"fmt"
+	"rsc.io/quote/v3"
+)
+
+func main() {
+	fmt.Println(quote.GoV3())
+}
+
+-- local/rsc.io/quote/v3/go.mod --
+module rsc.io/quote/v3
+
+require rsc.io/sampler v1.3.0
+
+-- local/rsc.io/quote/v3/quote.go --
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package quote collects pithy sayings.
+package quote
+
+import "rsc.io/sampler"
+
+// Hello returns a greeting.
+func HelloV3() string {
+	return sampler.Hello()
+}
+
+// Glass returns a useful phrase for world travelers.
+func GlassV3() string {
+	// See http://www.oocities.org/nodotus/hbglass.html.
+	return "I can eat glass and it doesn't hurt me."
+}
+
+// Go returns a REPLACED Go proverb.
+func GoV3() string {
+	return "Concurrency is not parallelism."
+}
+
+// Opt returns a optimization truth.
+func OptV3() string {
+	// Wisdom from ken.
+	return "If a program is too slow, it must have a loop."
+}
+
+-- local/not-rsc.io/quote/v3/go.mod --
+module not-rsc.io/quote/v3
+
+-- local/not-rsc.io/quote/v3/quote.go --
+package quote
+
+func GoV3() string {
+	return "Clear is better than clever."
+}
diff --git a/vendor/cmd/go/testdata/script/mod_test.txt b/vendor/cmd/go/testdata/script/mod_test.txt
new file mode 100644
index 0000000..a1ee8aa
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/mod_test.txt
@@ -0,0 +1,18 @@
+env GO111MODULE=on
+
+cd a/
+go test
+stdout PASS
+
+-- a/go.mod --
+module github.com/user/a
+
+-- a/a.go --
+package a
+
+-- a/a_test.go --
+package a
+
+import "testing"
+
+func Test(t *testing.T) {}
diff --git a/vendor/cmd/go/testdata/mod/mod_sync.txt b/vendor/cmd/go/testdata/script/mod_tidy.txt
similarity index 72%
rename from vendor/cmd/go/testdata/mod/mod_sync.txt
rename to vendor/cmd/go/testdata/script/mod_tidy.txt
index 868aa2c..86434af 100644
--- a/vendor/cmd/go/testdata/mod/mod_sync.txt
+++ b/vendor/cmd/go/testdata/script/mod_tidy.txt
@@ -1,7 +1,7 @@
 env GO111MODULE=on
 
-# sync removes unused y, but everything else is used
-go mod -sync -v
+# tidy removes unused y, but everything else is used
+go mod tidy -v
 stderr '^unused y.1'
 ! stderr '^unused [^y]'
 
@@ -19,11 +19,11 @@
 	w.1 v1.2.0
 )
 
-replace x.1 v1.0.0 => ../x
-replace y.1 v1.0.0 => ../y
-replace z.1 v1.1.0 => ../z
-replace z.1 v1.2.0 => ../z
-replace w.1 => ../w
+replace x.1 v1.0.0 => ./x
+replace y.1 v1.0.0 => ./y
+replace z.1 v1.1.0 => ./z
+replace z.1 v1.2.0 => ./z
+replace w.1 => ./w
 
 -- m.go --
 package m
diff --git a/vendor/cmd/go/testdata/script/mod_sync_quote.txt b/vendor/cmd/go/testdata/script/mod_tidy_quote.txt
similarity index 62%
rename from vendor/cmd/go/testdata/script/mod_sync_quote.txt
rename to vendor/cmd/go/testdata/script/mod_tidy_quote.txt
index 77f7b25..423c7c2 100644
--- a/vendor/cmd/go/testdata/script/mod_sync_quote.txt
+++ b/vendor/cmd/go/testdata/script/mod_tidy_quote.txt
@@ -1,13 +1,13 @@
-# Check that mod -sync does not introduce repeated
+# Check that mod tidy does not introduce repeated
 # require statements when input go.mod has quoted requirements.
 env GO111MODULE=on
 
-go mod -sync -json
-stdout -count=1 '"Path": "rsc.io/quote"'
+go mod tidy
+grep -count=1 rsc.io/quote go.mod
 
 cp go.mod2 go.mod
-go mod -sync -json
-stdout -count=1 '"Path": "rsc.io/quote"'
+go mod tidy
+grep -count=1 rsc.io/quote go.mod
 
 
 -- go.mod --
diff --git a/vendor/cmd/go/testdata/script/mod_sync_sum.txt b/vendor/cmd/go/testdata/script/mod_tidy_sum.txt
similarity index 87%
rename from vendor/cmd/go/testdata/script/mod_sync_sum.txt
rename to vendor/cmd/go/testdata/script/mod_tidy_sum.txt
index 1ecb6db..5a15818 100644
--- a/vendor/cmd/go/testdata/script/mod_sync_sum.txt
+++ b/vendor/cmd/go/testdata/script/mod_tidy_sum.txt
@@ -2,7 +2,7 @@
 
 # go.sum should list directly used modules and dependencies
 go get rsc.io/quote@v1.5.2
-go mod -sync
+go mod tidy
 grep rsc.io/sampler go.sum
 
 # go.sum should not normally lose old entries
@@ -11,8 +11,8 @@
 grep 'rsc.io/quote v1.5.2' go.sum
 grep rsc.io/sampler go.sum
 
-# go mod -sync should clear dead entries from go.sum
-go mod -sync
+# go mod tidy should clear dead entries from go.sum
+go mod tidy
 grep 'rsc.io/quote v1.0.0' go.sum
 ! grep 'rsc.io/quote v1.5.2' go.sum
 ! grep rsc.io/sampler go.sum
@@ -20,7 +20,7 @@
 # go.sum with no entries is OK to keep
 # (better for version control not to delete and recreate.)
 cp x.go.noimports x.go
-go mod -sync
+go mod tidy
 exists go.sum
 ! grep . go.sum
 
diff --git a/vendor/cmd/go/testdata/script/mod_vendor.txt b/vendor/cmd/go/testdata/script/mod_vendor.txt
index 31f422c..8915d15 100644
--- a/vendor/cmd/go/testdata/script/mod_vendor.txt
+++ b/vendor/cmd/go/testdata/script/mod_vendor.txt
@@ -5,12 +5,12 @@
 stdout '^w'
 
 [!short] go build
-[!short] ! go build -getmode=vendor
+[!short] ! go build -mod=vendor
 
 go list -f {{.Dir}} x
 stdout 'src[\\/]x'
 
-go mod -vendor -v
+go mod vendor -v
 stderr '^# x v1.0.0 => ./x'
 stderr '^x'
 stderr '^# y v1.0.0 => ./y'
@@ -25,16 +25,16 @@
 go list -f {{.Dir}} -m x
 stdout 'src[\\/]x'
 
-go list -getmode=vendor -f {{.Dir}} x
+go list -mod=vendor -f {{.Dir}} x
 stdout 'src[\\/]vendor[\\/]x'
 
-go list -getmode=vendor -f {{.Dir}} -m x
+go list -mod=vendor -f {{.Dir}} -m x
 stdout 'src[\\/]vendor[\\/]x'
 
 go list -f {{.Dir}} -m w
 stdout 'src[\\/]w'
 
-! go list -getmode=vendor -f {{.Dir}} w
+! go list -mod=vendor -f {{.Dir}} w
 stderr 'src[\\/]vendor[\\/]w'
 
 ! exists vendor/x/testdata
@@ -58,9 +58,9 @@
 [short] stop
 
 go build
-go build -getmode=vendor
-go test -getmode=vendor . ./subdir
-go test -getmode=vendor ./...
+go build -mod=vendor
+go test -mod=vendor . ./subdir
+go test -mod=vendor ./...
 
 -- go.mod --
 module m
diff --git a/vendor/cmd/go/testdata/script/mod_vendor_nodeps.txt b/vendor/cmd/go/testdata/script/mod_vendor_nodeps.txt
index 207bf24..e9a84ca 100644
--- a/vendor/cmd/go/testdata/script/mod_vendor_nodeps.txt
+++ b/vendor/cmd/go/testdata/script/mod_vendor_nodeps.txt
@@ -1,6 +1,6 @@
 env GO111MODULE=on
 
-go mod -vendor
+go mod vendor
 stderr '^go: no dependencies to vendor'
 
 -- go.mod --
diff --git a/vendor/cmd/go/testdata/script/mod_verify.txt b/vendor/cmd/go/testdata/script/mod_verify.txt
index 249cee6..50c9b4a 100644
--- a/vendor/cmd/go/testdata/script/mod_verify.txt
+++ b/vendor/cmd/go/testdata/script/mod_verify.txt
@@ -2,67 +2,67 @@
 
 # With good go.sum, verify succeeds by avoiding download.
 cp go.sum.good go.sum
-go mod -verify
-! exists $GOPATH/src/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
+go mod verify
+! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
 
 # With bad go.sum, verify succeeds by avoiding download.
 cp go.sum.bad go.sum
-go mod -verify
-! exists $GOPATH/src/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
+go mod verify
+! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
 
 # With bad go.sum, sync (which must download) fails.
 # Even if the bad sum is in the old legacy go.modverify file.
 rm go.sum
 cp go.sum.bad go.modverify
-! go mod -sync
+! go mod tidy
 stderr 'checksum mismatch'
-! exists $GOPATH/src/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
+! exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
 
 # With good go.sum, sync works (and moves go.modverify to go.sum).
 rm go.sum
 cp go.sum.good go.modverify
-go mod -sync
-exists $GOPATH/src/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
-exists $GOPATH/src/mod/rsc.io/quote@v1.1.0/quote.go
+go mod tidy
+exists $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.zip
+exists $GOPATH/pkg/mod/rsc.io/quote@v1.1.0/quote.go
 ! exists go.modverify
 
 # go.sum should have the new checksum for go.mod
 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum
 
 # verify should work
-go mod -verify
+go mod verify
 
 # basic loading of module graph should detect incorrect go.mod files.
-go mod -graph
+go mod graph
 cp go.sum.bad2 go.sum
-! go mod -graph
+! go mod graph
 stderr 'go.mod: checksum mismatch'
 
 # go.sum should be created and updated automatically.
 rm go.sum
-go mod -graph
+go mod graph
 exists go.sum
 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum
 ! grep '^rsc.io/quote v1.1.0 ' go.sum
 
-go mod -sync
+go mod tidy
 grep '^rsc.io/quote v1.1.0/go.mod ' go.sum
 grep '^rsc.io/quote v1.1.0 ' go.sum
 
 # sync should ignore missing ziphash; verify should not
-rm $GOPATH/src/mod/cache/download/rsc.io/quote/@v/v1.1.0.ziphash
-go mod -sync
-! go mod -verify
+rm $GOPATH/pkg/mod/cache/download/rsc.io/quote/@v/v1.1.0.ziphash
+go mod tidy
+! go mod verify
 
 # Packages below module root should not be mentioned in go.sum.
 rm go.sum
-go mod -droprequire rsc.io/quote
+go mod edit -droprequire rsc.io/quote
 go list rsc.io/quote/buggy # re-resolves import path and updates go.mod
 grep '^rsc.io/quote v1.5.2/go.mod ' go.sum
 ! grep buggy go.sum
 
 # non-existent packages below module root should not be mentioned in go.sum
-go mod -droprequire rsc.io/quote
+go mod edit -droprequire rsc.io/quote
 ! go list rsc.io/quote/morebuggy
 grep '^rsc.io/quote v1.5.2/go.mod ' go.sum
 ! grep buggy go.sum
diff --git a/vendor/cmd/go/testdata/script/mod_version_nomod.txt b/vendor/cmd/go/testdata/script/mod_version_nomod.txt
deleted file mode 100644
index 4cd5424..0000000
--- a/vendor/cmd/go/testdata/script/mod_version_nomod.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Test go version with no module.
-env GO111MODULE=on
-! go mod -json
-go version
diff --git a/vendor/cmd/go/testdata/script/test_compile_binary.txt b/vendor/cmd/go/testdata/script/test_compile_binary.txt
new file mode 100644
index 0000000..6c01bc5
--- /dev/null
+++ b/vendor/cmd/go/testdata/script/test_compile_binary.txt
@@ -0,0 +1,6 @@
+! go test -c compile_binary/...
+stderr 'build comment'
+
+-- compile_binary/foo_test.go --
+//+build foo
+package foo