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 package main
import ( import (
...@@ -10,6 +12,7 @@ import ( ...@@ -10,6 +12,7 @@ import (
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"sort"
"strings" "strings"
) )
...@@ -65,8 +68,14 @@ func codegen(w io.Writer, m map[string]string) { ...@@ -65,8 +68,14 @@ func codegen(w io.Writer, m map[string]string) {
io.WriteString(w, ` io.WriteString(w, `
var sriMap = map[string]string{ var sriMap = map[string]string{
`) `)
for k, v := range m { // Dump the map in sorted order.
fmt.Fprintf(w, "\t%q: %q,\n", k, v) 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") 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