Chore: Enable Go linter gocritic (#26224)

* Chore: Enable gocritic linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-07-16 14:39:01 +02:00
committed by GitHub
parent 317c7b269c
commit d4e4cb4c71
43 changed files with 184 additions and 171 deletions

View File

@ -201,9 +201,8 @@ func (f *JSONFormatter) processArray(array []interface{}, deltas []diff.Delta) e
// additional Added
for _, delta := range deltas {
switch delta.(type) {
case *diff.Added:
d := delta.(*diff.Added)
d, ok := delta.(*diff.Added)
if ok {
// skip items already processed
if int(d.Position.(diff.Index)) < len(array) {
continue
@ -226,9 +225,9 @@ func (f *JSONFormatter) processObject(object map[string]interface{}, deltas []di
// Added
for _, delta := range deltas {
switch delta := delta.(type) {
case *diff.Added:
f.printRecursive(delta.Position.String(), delta.Value, ChangeAdded)
d, ok := delta.(*diff.Added)
if ok {
f.printRecursive(d.Position.String(), d.Value, ChangeAdded)
}
}