From 61caa240c8087c866c94ecab6afee05a4083aff5 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 31 Jan 2017 10:19:48 -0800 Subject: [PATCH] Sort testcases to make build (more) reproducible f.Scope.Objects is a map, so iteration order isn't defined. To fix this, lets just sort the testcase list so that it's always consistent. There are still some paths in the built go files, but this improves repeatability using the same paths. Test: Build twice, compare generated test.go files. Change-Id: Ie3fc896f54314fee0e0e9ddc3a9e06ad2f72a78d --- gotestmain/gotestmain.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gotestmain/gotestmain.go b/gotestmain/gotestmain.go index ff4a5ba..8d1287c 100644 --- a/gotestmain/gotestmain.go +++ b/gotestmain/gotestmain.go @@ -23,6 +23,7 @@ import ( "go/token" "io/ioutil" "os" + "sort" "strings" "text/template" ) @@ -51,6 +52,7 @@ func findTests(srcs []string) (tests []string) { tests = append(tests, obj.Name) } } + sort.Strings(tests) return }