Skip to content

Commit

Permalink
fix: sarif_test.go: actualJSON, expectJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
irgaly committed Jan 26, 2024
1 parent 9bd6192 commit 15afd8e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions parser/sarif_test.go
Expand Up @@ -24,16 +24,16 @@ func TestExampleSarifParser(t *testing.T) {
}
for _, d := range diagnostics {
rdjson, _ := protojson.MarshalOptions{Indent: " "}.Marshal(d)
var actualJson map[string]interface{}
var expectJson map[string]interface{}
json.Unmarshal([]byte(rdjson), &actualJson)
json.Unmarshal([]byte(fixture[1]), &expectJson)
expectJson["originalOutput"] = actualJson["originalOutput"]
if !reflect.DeepEqual(actualJson, expectJson) {
var actualJSON map[string]interface{}
var expectJSON map[string]interface{}
json.Unmarshal([]byte(rdjson), &actualJSON)
json.Unmarshal([]byte(fixture[1]), &expectJSON)
expectJSON["originalOutput"] = actualJSON["originalOutput"]
if !reflect.DeepEqual(actualJSON, expectJSON) {
var out bytes.Buffer
json.Indent(&out, rdjson, "", "\t")
actual := out.String()
expect, _ := json.MarshalIndent(expectJson, "", "\t")
expect, _ := json.MarshalIndent(expectJSON, "", "\t")

Check failure on line 36 in parser/sarif_test.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

[golangci] reported by reviewdog 馃惗 Error return value of `encoding/json.MarshalIndent` is not checked: unsafe type `interface{}` found (errchkjson) Raw Output: parser/sarif_test.go:36:18: Error return value of `encoding/json.MarshalIndent` is not checked: unsafe type `interface{}` found (errchkjson) expect, _ := json.MarshalIndent(expectJSON, "", "\t") ^
t.Errorf("actual(%v):\n%v\n---\nexpect(%v):\n%v", i, actual, i, string(expect))
}
}
Expand Down

0 comments on commit 15afd8e

Please sign in to comment.