Skip to content

Commit

Permalink
libct/intelrdt: fix a staticcheck warning
Browse files Browse the repository at this point in the history
> libcontainer/intelrdt/monitoring.go:24:2: SA5001: should check returned error before deferring file.Close() (staticcheck)
> 	defer file.Close()
> 	^

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Dec 1, 2020
1 parent 0dd877a commit ff6896a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libcontainer/intelrdt/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package intelrdt

import (
"bufio"
"github.com/sirupsen/logrus"
"io"
"io/ioutil"
"os"
"path/filepath"

"github.com/sirupsen/logrus"
)

var (
Expand All @@ -21,10 +22,10 @@ type monFeatures struct {

func getMonFeatures(intelRdtRoot string) (monFeatures, error) {
file, err := os.Open(filepath.Join(intelRdtRoot, "info", "L3_MON", "mon_features"))
defer file.Close()
if err != nil {
return monFeatures{}, err
}
defer file.Close()
return parseMonFeatures(file)
}

Expand Down

0 comments on commit ff6896a

Please sign in to comment.