File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
24
24
"encoding/json"
25
25
"errors"
26
26
"fmt"
27
+ "sort"
27
28
)
28
29
29
30
// Each panel may be one of these types.
@@ -1209,11 +1210,18 @@ func (c customPanelOutput) MarshalJSON() ([]byte, error) {
1209
1210
// Append custom keys to marshalled CommonPanel.
1210
1211
buf := bytes .NewBuffer (b [:len (b )- 1 ])
1211
1212
1212
- for k , v := range c .CustomPanel {
1213
+ // Sort keys to make output idempotent
1214
+ keys := make ([]string , 0 , len (c .CustomPanel ))
1215
+ for k := range c .CustomPanel {
1216
+ keys = append (keys , k )
1217
+ }
1218
+ sort .Strings (keys )
1219
+
1220
+ for _ , k := range keys {
1213
1221
buf .WriteString (`,"` )
1214
1222
buf .WriteString (k )
1215
1223
buf .WriteString (`":` )
1216
- b , err := json .Marshal (v )
1224
+ b , err := json .Marshal (c . CustomPanel [ k ] )
1217
1225
if err != nil {
1218
1226
return b , err
1219
1227
}
You can’t perform that action at this time.
0 commit comments