Fix ifElseChain lint errors

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2023-08-29 10:12:45 +02:00
parent 48d68e4eff
commit acc50969dc
4 changed files with 21 additions and 16 deletions

View File

@@ -193,14 +193,15 @@ func (c testConfig) getRuntimeSpec() (specs.Spec, error) {
defer jsonFile.Close()
jsonContent, err := io.ReadAll(jsonFile)
if err != nil {
switch {
case err != nil:
return spec, err
} else if json.Valid(jsonContent) {
case json.Valid(jsonContent):
err = json.Unmarshal(jsonContent, &spec)
if err != nil {
return spec, err
}
} else {
default:
err = json.NewDecoder(bytes.NewReader(jsonContent)).Decode(&spec)
if err != nil {
return spec, err