summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.golangci.yml1
-rw-r--r--test/utils/common_function_test.go5
-rw-r--r--test/utils/utils.go5
3 files changed, 7 insertions, 4 deletions
diff --git a/.golangci.yml b/.golangci.yml
index 95c570bb7..a27d96bcf 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -62,7 +62,6 @@ linters:
- ireturn
- tagliatelle
- varnamelen
- - errchkjson
- maintidx
- nilerr
- nilnil
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go
index 810d9f2a5..144d8d4f1 100644
--- a/test/utils/common_function_test.go
+++ b/test/utils/common_function_test.go
@@ -102,9 +102,10 @@ var _ = Describe("Common functions test", func() {
Item2: []string{"test"},
}
- testByte, _ := json.Marshal(testData)
- err := WriteJSONFile(testByte, "/tmp/testJSON")
+ testByte, err := json.Marshal(testData)
+ Expect(err).To(BeNil(), "Failed to marshal data.")
+ err = WriteJSONFile(testByte, "/tmp/testJSON")
Expect(err).To(BeNil(), "Failed to write JSON to file.")
read, err := os.Open("/tmp/testJSON")
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 8fe45dca0..a6295cd19 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -479,7 +479,10 @@ func IsCommandAvailable(command string) bool {
func WriteJSONFile(data []byte, filePath string) error {
var jsonData map[string]interface{}
json.Unmarshal(data, &jsonData)
- formatJSON, _ := json.MarshalIndent(jsonData, "", " ")
+ formatJSON, err := json.MarshalIndent(jsonData, "", " ")
+ if err != nil {
+ return err
+ }
return ioutil.WriteFile(filePath, formatJSON, 0644)
}