fix: compare container specs with equate empty option (nil map == {} map)

This commit is contained in:
Pavel Sviderski
2025-04-22 23:31:45 +10:00
parent d6ff62159d
commit 16c876d83f
3 changed files with 7 additions and 6 deletions
+3 -2
View File
@@ -4,11 +4,12 @@ import (
"encoding/json"
"fmt"
"maps"
"reflect"
"regexp"
"slices"
"github.com/distribution/reference"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/psviderski/uncloud/internal/machine/api/pb"
)
@@ -213,7 +214,7 @@ func (s *ContainerSpec) Equals(spec ContainerSpec) bool {
sortVolumeMounts(orig.VolumeMounts)
sortVolumeMounts(spec.VolumeMounts)
return reflect.DeepEqual(orig, spec)
return cmp.Equal(orig, spec, cmpopts.EquateEmpty())
}
func (s *ContainerSpec) Clone() ContainerSpec {