I ran govanish linter (it still in the WIP phase) against gval repo and it found that one error handling branch were eliminated by compiler:
2023/12/24 21:05:32 it seems like your code vanished from compiled binary: func=[parseJSONObject], file=[/home/sivukhin/code/gval/parse.go], line=[320], snippet:
return nil, p.Expected("object", ':')
if p.Scan() != ':' {
if err != nil {
return nil, p.Expected("object", ':')
}
}
Indeed, errcheck in this case is useless and actually prevent parsing from correct behaviour: rejecting invalid JSON structure.
This PR remove err check and always return error if p.Scan() return incorrect symbol.
Also, test Invalid json key:value structure for incorrect JSON structure were added (it were red before fix and became green after)
I ran govanish linter (it still in the WIP phase) against
gval
repo and it found that one error handling branch were eliminated by compiler:Indeed, errcheck in this case is useless and actually prevent parsing from correct behaviour: rejecting invalid JSON structure.
This PR remove err check and always return error if
p.Scan()
return incorrect symbol.Also, test
Invalid json key:value structure
for incorrect JSON structure were added (it were red before fix and became green after)