feat: sort output of jsonnetfile

To keep the output deterministic, both `jsonnetfile.json` and the lockfile are
now sorted alphabetically by the packages name
This commit is contained in:
sh0rez 2019-10-16 17:37:57 +02:00
parent ffd43cf94e
commit cc1d7ea3b8
No known key found for this signature in database
GPG key ID: 87C71DF9F8181FF1

View file

@ -46,6 +46,9 @@ func (jf JsonnetFile) MarshalJSON() ([]byte, error) {
s.Dependencies = append(s.Dependencies, d)
}
sort.SliceStable(s.Dependencies, func(i int, j int) bool {
return s.Dependencies[i].Name < s.Dependencies[j].Name
})
return json.Marshal(s)
}