From ea3d9c86ba087d4e3f2791bb5ad7a3f91ab5972a Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 9 Jun 2017 09:15:38 -0400 Subject: [PATCH] sort constraints for consistent output --- plugin/discovery/version_set.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/discovery/version_set.go b/plugin/discovery/version_set.go index 273aca990..0aefd759f 100644 --- a/plugin/discovery/version_set.go +++ b/plugin/discovery/version_set.go @@ -1,6 +1,8 @@ package discovery import ( + "sort" + version "github.com/hashicorp/go-version" ) @@ -61,6 +63,11 @@ func (s Constraints) Append(other Constraints) Constraints { raw = append(raw, s.raw...) raw = append(raw, other.raw...) + // while the set is unordered, we sort these lexically for consistent output + sort.Slice(raw, func(i, j int) bool { + return raw[i].String() < raw[j].String() + }) + return Constraints{raw} }