diff options
author | David Benjamin <davidben@chromium.org> | 2015-02-09 21:30:53 -0500 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-02-10 03:56:04 +0000 |
commit | fc233962dba775a1f2ec8657385c0c43cc9b37f9 (patch) | |
tree | 378c19577bd9c1ecd53d6a2b9081c9b3e286e925 | |
parent | e8fe46adf05d5f642492ccdadf56485f2b9f052a (diff) | |
download | boringssl-fc233962dba775a1f2ec8657385c0c43cc9b37f9.zip boringssl-fc233962dba775a1f2ec8657385c0c43cc9b37f9.tar.gz boringssl-fc233962dba775a1f2ec8657385c0c43cc9b37f9.tar.bz2 |
Make make_errors.go -reset reproducible.
Change-Id: I71114e26149d66acc9f9c66464b8a2a64a59cadc
Reviewed-on: https://boringssl-review.googlesource.com/3381
Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r-- | util/make_errors.go | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/util/make_errors.go b/util/make_errors.go index cd7c8dd..d1e5438 100644 --- a/util/make_errors.go +++ b/util/make_errors.go @@ -319,16 +319,23 @@ func assignNewValues(assignments map[string]int, reserved int) { max++ + // Sort the keys, so this script is reproducible. + keys := make([]string, 0, len(assignments)) for key, value := range assignments { if value == -1 { - if reserved >= 0 && max >= reserved { - // If this happens, try passing - // -reset. Otherwise bump up reservedReasonCode. - panic("Automatically-assigned values exceeded limit!") - } - assignments[key] = max - max++ + keys = append(keys, key) + } + } + sort.Strings(keys) + + for _, key := range keys { + if reserved >= 0 && max >= reserved { + // If this happens, try passing -reset. Otherwise bump + // up reservedReasonCode. + panic("Automatically-assigned values exceeded limit!") } + assignments[key] = max + max++ } } |