mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
Use maps.Equal to compare maps (#3460)
Signed-off-by: shuheiktgw <s-kitagawa@mercari.com>
This commit is contained in:
parent
bddca97cf2
commit
13dd16bf6d
1 changed files with 2 additions and 15 deletions
|
@ -19,6 +19,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
@ -181,7 +182,7 @@ func (c *Client) PushSecret(ctx context.Context, secret *corev1.Secret, pushSecr
|
|||
return err
|
||||
}
|
||||
|
||||
if !mapEqual(gcpSecret.Annotations, annotations) || !mapEqual(gcpSecret.Labels, labels) {
|
||||
if !maps.Equal(gcpSecret.Annotations, annotations) || !maps.Equal(gcpSecret.Labels, labels) {
|
||||
_, err = c.smClient.UpdateSecret(ctx, &secretmanagerpb.UpdateSecretRequest{
|
||||
Secret: &secretmanagerpb.Secret{
|
||||
Name: gcpSecret.Name,
|
||||
|
@ -548,17 +549,3 @@ func getDataByProperty(data []byte, property string) gjson.Result {
|
|||
}
|
||||
return gjson.Get(payload, property)
|
||||
}
|
||||
|
||||
func mapEqual(m1, m2 map[string]string) bool {
|
||||
if len(m1) != len(m2) {
|
||||
return false
|
||||
}
|
||||
|
||||
for k1, v1 := range m1 {
|
||||
if v2, ok := m2[k1]; !ok || v1 != v2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue