From d20cbc12f1322f4cd71aa9b9d8c6291f27d4b525 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 15 Jan 2014 22:55:52 -0500 Subject: [PATCH] go.tools/oracle: eliminate reliance on undefined map iteration order. (Unmasked by recent randomization of small (<8) map iteration.) R=gri, crawshaw, bradfitz CC=golang-codereviews https://golang.org/cl/51170044 --- oracle/callgraph.go | 1 + oracle/oracle_test.go | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oracle/callgraph.go b/oracle/callgraph.go index 53e559b8..91b05d27 100644 --- a/oracle/callgraph.go +++ b/oracle/callgraph.go @@ -127,6 +127,7 @@ func (r *callgraphResult) toSerial(res *serial.Result, fset *token.FileSet) { for callee := range call.CalleesOf(n) { j.Children = append(j.Children, numbering[callee]) } + sort.Ints(j.Children) } res.Callgraph = cg } diff --git a/oracle/oracle_test.go b/oracle/oracle_test.go index 2ab26973..85a3ae4b 100644 --- a/oracle/oracle_test.go +++ b/oracle/oracle_test.go @@ -211,8 +211,7 @@ func TestOracle(t *testing.T) { "testdata/src/main/what.go", // JSON: // TODO(adonovan): most of these are very similar; combine them. - // TODO(adonovan): enable this test once it works again. - //"testdata/src/main/callgraph-json.go", + "testdata/src/main/callgraph-json.go", "testdata/src/main/calls-json.go", "testdata/src/main/peers-json.go", "testdata/src/main/describe-json.go",