Reproducible Builds: Sort protoList before marshal (#605)

This commit is contained in:
kpcyrd 2021-08-16 01:48:12 +00:00 committed by GitHub
parent dc8b361354
commit 6ccee886e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)