From cc1d7ea3b8d1acefb721c3981e53a7f875c637b6 Mon Sep 17 00:00:00 2001 From: sh0rez Date: Wed, 16 Oct 2019 17:37:57 +0200 Subject: [PATCH] feat: sort output of jsonnetfile To keep the output deterministic, both `jsonnetfile.json` and the lockfile are now sorted alphabetically by the packages name --- spec/spec.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/spec.go b/spec/spec.go index efa4a2e..00e9e45 100644 --- a/spec/spec.go +++ b/spec/spec.go @@ -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) }