Merge pull request #6954 from vvoland/stable-labels

formatter: Sort labels for stable output
diff --git a/cli/command/config/formatter.go b/cli/command/config/formatter.go
index 09b2643..8e0b296 100644
--- a/cli/command/config/formatter.go
+++ b/cli/command/config/formatter.go
@@ -1,7 +1,11 @@
+// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
+//go:build go1.25
+
 package config
 
 import (
 	"fmt"
+	"slices"
 	"strings"
 	"time"
 
@@ -102,6 +106,7 @@
 	for k, v := range mapLabels {
 		joinLabels = append(joinLabels, k+"="+v)
 	}
+	slices.Sort(joinLabels)
 	return strings.Join(joinLabels, ",")
 }
 
diff --git a/cli/command/formatter/volume.go b/cli/command/formatter/volume.go
index e3d4b19..75b6ad0 100644
--- a/cli/command/formatter/volume.go
+++ b/cli/command/formatter/volume.go
@@ -1,7 +1,11 @@
+// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
+//go:build go1.25
+
 package formatter
 
 import (
 	"fmt"
+	"slices"
 	"strconv"
 	"strings"
 
@@ -104,6 +108,7 @@
 	for k, v := range c.v.Labels {
 		joinLabels = append(joinLabels, k+"="+v)
 	}
+	slices.Sort(joinLabels)
 	return strings.Join(joinLabels, ",")
 }
 
diff --git a/cli/command/formatter/volume_test.go b/cli/command/formatter/volume_test.go
index 1fa2770..b85a75c 100644
--- a/cli/command/formatter/volume_test.go
+++ b/cli/command/formatter/volume_test.go
@@ -48,9 +48,7 @@
 	for _, c := range cases {
 		ctx = c.volumeCtx
 		v := c.call()
-		if strings.Contains(v, ",") {
-			test.CompareMultipleValues(t, v, c.expValue)
-		} else if v != c.expValue {
+		if v != c.expValue {
 			t.Fatalf("Expected %s, was %s\n", c.expValue, v)
 		}
 	}
diff --git a/cli/command/network/formatter.go b/cli/command/network/formatter.go
index 2a62bdb..cbc72a7 100644
--- a/cli/command/network/formatter.go
+++ b/cli/command/network/formatter.go
@@ -1,6 +1,10 @@
+// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
+//go:build go1.25
+
 package network
 
 import (
+	"slices"
 	"strconv"
 	"strings"
 
@@ -115,6 +119,7 @@
 	for k, v := range c.n.Labels {
 		joinLabels = append(joinLabels, k+"="+v)
 	}
+	slices.Sort(joinLabels)
 	return strings.Join(joinLabels, ",")
 }
 
diff --git a/cli/command/network/formatter_test.go b/cli/command/network/formatter_test.go
index 4642ee3..8a9635a 100644
--- a/cli/command/network/formatter_test.go
+++ b/cli/command/network/formatter_test.go
@@ -68,9 +68,7 @@
 	for _, c := range cases {
 		ctx = c.networkCtx
 		v := c.call()
-		if strings.Contains(v, ",") {
-			test.CompareMultipleValues(t, v, c.expValue)
-		} else if v != c.expValue {
+		if v != c.expValue {
 			t.Fatalf("Expected %s, was %s\n", c.expValue, v)
 		}
 	}
diff --git a/cli/command/secret/formatter.go b/cli/command/secret/formatter.go
index 5762165..bc71299 100644
--- a/cli/command/secret/formatter.go
+++ b/cli/command/secret/formatter.go
@@ -1,7 +1,11 @@
+// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:
+//go:build go1.25
+
 package secret
 
 import (
 	"fmt"
+	"slices"
 	"strings"
 	"time"
 
@@ -109,6 +113,7 @@
 	for k, v := range mapLabels {
 		joinLabels = append(joinLabels, k+"="+v)
 	}
+	slices.Sort(joinLabels)
 	return strings.Join(joinLabels, ",")
 }