Right now they are in a deterministic order
but one that depends on the shape of the import graph.
Sort them instead.
Change-Id: Ia0c076a0d6677a511e52acf01f38353e9895dec2
Reviewed-on: https://go-review.googlesource.com/c/go/+/174527
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
"io/ioutil"
"os"
"path/filepath"
+ "sort"
"strings"
"cmd/go/internal/base"
if cfg.BuildV {
fmt.Fprintf(os.Stderr, "# %s %s%s\n", m.Path, m.Version, repl)
}
+ sort.Strings(pkgs)
for _, pkg := range pkgs {
fmt.Fprintf(&buf, "%s\n", pkg)
if cfg.BuildV {
stderr '^# z v1.0.0 => ./z'
stderr '^z'
! stderr '^w'
+grep 'a/foo/bar/b\na/foo/bar/c' vendor/modules.txt # must be sorted
go list -f {{.Dir}} x
stdout 'src[\\/]x'
}
-- a/foo/bar/c/main.go --
package c
+import _ "a/foo/bar/b"
-- a/foo/bar/c/main_test.go --
package c
-- testdata2.go --
package m
-import _ "a/foo/bar/b"
import _ "a/foo/bar/c"
-- v1.go --
package m