|
Minux Ma |
at Oct 19, 2012 at 3:50 pm
|
⇧ |
| |
Reviewers: golang-dev_googlegroups.com,
Message:
Hello
golang-dev@googlegroups.com (cc:
golang-dev@googlegroups.com),
I'd like you to review this change to
https://code.google.com/p/go/Description:
cmd/go: make package list order predicable
also add a cleanup phase to cmd/go/test.bash.
Please review this at
http://codereview.appspot.com/6741050/Affected files:
M src/cmd/go/pkg.go
M src/cmd/go/test.bash
Index: src/cmd/go/pkg.go
===================================================================
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -674,12 +674,11 @@
var set = make(map[string]bool)
for _, arg := range args {
- set[arg] = true
+ if !set[arg] {
+ pkgs = append(pkgs, loadPackage(arg, &stk))
+ set[arg] = true
+ }
}
- for arg := range set {
- pkgs = append(pkgs, loadPackage(arg, &stk))
- }
-
computeStale(pkgs...)
return pkgs
Index: src/cmd/go/test.bash
===================================================================
--- a/src/cmd/go/test.bash
+++ b/src/cmd/go/test.bash
@@ -142,6 +142,18 @@
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 doesn't show in consistent order"
+ 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