diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-04-22 11:51:53 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-04-22 12:51:29 +0200 |
commit | 2a8e435671186bead0e02b13f55e118724175cce (patch) | |
tree | c5e39d30702560528d6a340ef1daf7b145be8534 /test/utils | |
parent | 56d6ee0808d30c96289568724d748a0e85008638 (diff) | |
download | podman-2a8e435671186bead0e02b13f55e118724175cce.tar.gz podman-2a8e435671186bead0e02b13f55e118724175cce.tar.bz2 podman-2a8e435671186bead0e02b13f55e118724175cce.zip |
enable staticcheck linter
Fix many problems reported by the staticcheck linter, including many
real bugs!
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/common_function_test.go | 3 | ||||
-rw-r--r-- | test/utils/utils.go | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go index 6323b44eb..a73d75490 100644 --- a/test/utils/common_function_test.go +++ b/test/utils/common_function_test.go @@ -110,9 +110,8 @@ var _ = Describe("Common functions test", func() { Expect(err).To(BeNil(), "Failed to write JSON to file.") read, err := os.Open("/tmp/testJSON") - defer read.Close() - Expect(err).To(BeNil(), "Can not find the JSON file after we write it.") + defer read.Close() bytes, _ := ioutil.ReadAll(read) json.Unmarshal(bytes, compareData) diff --git a/test/utils/utils.go b/test/utils/utils.go index 39a0ac875..9695835e5 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -439,10 +439,10 @@ func tagOutputToMap(imagesOutput []string) map[string]map[string]bool { // GetHostDistributionInfo returns a struct with its distribution Name and version func GetHostDistributionInfo() HostOS { f, err := os.Open(OSReleasePath) - defer f.Close() if err != nil { return HostOS{} } + defer f.Close() l := bufio.NewScanner(f) host := HostOS{} |