Skip to content

Commit fd1e042

Browse files
committed
PR-676 update code based on review
Signed-off-by: longquan0104 <longquan0104@gmail.com>
1 parent 45c9623 commit fd1e042

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ api-docs: gen-crd-api-reference-docs
8585

8686
# Run go mod tidy
8787
tidy:
88-
cd api; rm -f go.sum; go mod tidy -compat=1.19
89-
rm -f go.sum; go mod tidy -compat=1.19
88+
cd api; rm -f go.sum; go mod tidy -compat=1.20
89+
rm -f go.sum; go mod tidy -compat=1.20
9090

9191
# Run go fmt against code
9292
fmt:

internal/util/util.go

+4-15
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ import (
3030
// given chartutil.Values.
3131
func ValuesChecksum(values map[string]interface{}) string {
3232
newValues := copyValues(values)
33-
var (
34-
s []byte
35-
err error
36-
)
33+
var s []byte
3734

3835
if len(newValues) != 0 {
3936
// cleanUpInterfaceMap
@@ -44,10 +41,7 @@ func ValuesChecksum(values map[string]interface{}) string {
4441
// Sort
4542
SortMapSlice(msValues)
4643
// Marshal
47-
s, err = goyaml.Marshal(msValues)
48-
if err != nil {
49-
panic(err)
50-
}
44+
s, _ = goyaml.Marshal(msValues)
5145
}
5246
// Gethash
5347
return fmt.Sprintf("%x", sha1.Sum(s))
@@ -76,10 +70,8 @@ func cleanUpMapValue(v interface{}) interface{} {
7670
return cleanUpInterfaceArray(v)
7771
case map[interface{}]interface{}:
7872
return cleanUpInterfaceMap(v)
79-
case string:
80-
return v
8173
default:
82-
return fmt.Sprintf("%v", v)
74+
return v
8375
}
8476
}
8577

@@ -101,10 +93,7 @@ func cleanUpInterfaceArray(in []interface{}) []interface{} {
10193

10294
func copyValues(in map[string]interface{}) map[string]interface{} {
10395
// Marshal
104-
coppiedValues, err := goyaml.Marshal(in)
105-
if err != nil {
106-
panic(err)
107-
}
96+
coppiedValues, _ := goyaml.Marshal(in)
10897
// Unmarshal
10998
newValues := make(map[string]interface{})
11099
goyaml.Unmarshal(coppiedValues, newValues)

0 commit comments

Comments
 (0)