Commit 8cdfe362 authored by Bowei Du's avatar Bowei Du

Update generated code to stable order

parent e609cda0
...@@ -28,6 +28,7 @@ import ( ...@@ -28,6 +28,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"sort"
"text/template" "text/template"
"time" "time"
...@@ -1110,7 +1111,14 @@ func Test{{.Service}}Group(t *testing.T) { ...@@ -1110,7 +1111,14 @@ func Test{{.Service}}Group(t *testing.T) {
} }
` `
tmpl := template.Must(template.New("unittest").Parse(text)) tmpl := template.Must(template.New("unittest").Parse(text))
for _, s := range meta.AllServicesByGroup { // Sort keys so the output will be stable.
var keys []string
for k, _ := range meta.AllServicesByGroup {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
s := meta.AllServicesByGroup[k]
if err := tmpl.Execute(wr, s); err != nil { if err := tmpl.Execute(wr, s); err != nil {
panic(err) panic(err)
} }
......
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