Skip to content
Snippets Groups Projects
Commit 6e9891f4 authored by ale's avatar ale
Browse files

Generate the SRI map in sorted order

Being consistent across runs avoids generating spurious git changes.
parent c8f18956
No related branches found
No related tags found
1 merge request!6Refactor the login handler
// +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")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment