Commit 6e9891f4 authored by ale's avatar ale

Generate the SRI map in sorted order

Being consistent across runs avoids generating spurious git changes.
parent c8f18956
// +build ignore
package main
import (
......@@ -10,6 +12,7 @@ import (
"log"
"os"
"path/filepath"
"sort"
"strings"
)
......@@ -65,8 +68,14 @@ func codegen(w io.Writer, m map[string]string) {
io.WriteString(w, `
var sriMap = map[string]string{
`)
for k, v := range m {
fmt.Fprintf(w, "\t%q: %q,\n", k, v)
// Dump the map in sorted order.
var keys []string
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintf(w, "\t%q: %q,\n", k, m[k])
}
io.WriteString(w, "}\n")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment