From 62f45189e118c51d0674f76023403a226dfc04c7 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Sun, 10 Dec 2017 21:04:44 -0500 Subject: [PATCH] Sort default cidrs for reproducible builds In different distros or environments, we may end up with a different order of the default string printed during help and man page generation, So we should sort so the string we print is the same everytime. --- pkg/cloudprovider/providers/gce/gce_loadbalancer.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/providers/gce/gce_loadbalancer.go b/pkg/cloudprovider/providers/gce/gce_loadbalancer.go index 6b8995b2f50..3d8f68e6f84 100644 --- a/pkg/cloudprovider/providers/gce/gce_loadbalancer.go +++ b/pkg/cloudprovider/providers/gce/gce_loadbalancer.go @@ -20,6 +20,7 @@ import ( "flag" "fmt" "net" + "sort" "strings" "github.com/golang/glog" @@ -62,7 +63,9 @@ func init() { // String is the method to format the flag's value, part of the flag.Value interface. func (c *cidrs) String() string { - return strings.Join(c.ipn.StringSlice(), ",") + s := c.ipn.StringSlice() + sort.Strings(s) + return strings.Join(s, ",") } // Set supports a value of CSV or the flag repeated multiple times