]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: make package list order predicable
authorShenghou Ma <minux.ma@gmail.com>
Sat, 20 Oct 2012 09:25:13 +0000 (17:25 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Sat, 20 Oct 2012 09:25:13 +0000 (17:25 +0800)
also add a cleanup phase to cmd/go/test.bash.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6741050

src/cmd/go/pkg.go
src/cmd/go/test.bash

index 345d8fb54bc15a8176c2afbb6e2e7692df351850..f05cf01947592e7b2089e5e1556022624c2c84ba 100644 (file)
@@ -674,12 +674,11 @@ func packagesAndErrors(args []string) []*Package {
        var set = make(map[string]bool)
 
        for _, arg := range args {
-               set[arg] = true
-       }
-       for arg := range set {
-               pkgs = append(pkgs, loadPackage(arg, &stk))
+               if !set[arg] {
+                       pkgs = append(pkgs, loadPackage(arg, &stk))
+                       set[arg] = true
+               }
        }
-
        computeStale(pkgs...)
 
        return pkgs
index e88610cfe83f5d10f7c0f3a94a83e12f5b54382d..350fdb89fa8f5f955975e0aea81a6651217719ea 100755 (executable)
@@ -142,6 +142,18 @@ if [ $(./testgo test fmt fmt fmt fmt fmt | wc -l) -ne 1 ] ; then
     ok=false
 fi
 
+# ensure that output of 'go list' is consistent between runs
+./testgo list std > test_std.list
+if ! ./testgo list std | cmp -s test_std.list - ; then
+       echo "go list std ordering is inconsistent"
+       ok=false
+fi
+rm -f test_std.list
+
+# clean up
+rm -rf testdata/bin testdata/bin1
+rm -f testgo
+
 if $ok; then
        echo PASS
 else