From 6ccee886e3314050523ecda538018a21a9143c5b Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Mon, 16 Aug 2021 01:48:12 +0000 Subject: [PATCH] Reproducible Builds: Sort protoList before marshal (#605) --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 976d5fa0..a348a11f 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "sort" "strconv" "strings" @@ -372,6 +373,11 @@ func main() { } } + // Sort protoList so the marshaled list is reproducible + sort.SliceStable(protoList.Entry, func(i, j int) bool { + return protoList.Entry[i].CountryCode < protoList.Entry[j].CountryCode + }) + protoBytes, err := proto.Marshal(protoList) if err != nil { fmt.Println("Failed:", err)