errcheck: libcontainer

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2021-02-01 19:33:47 +01:00
parent 463ee5e19a
commit b45fbd43b8
8 changed files with 44 additions and 37 deletions

View File

@@ -122,7 +122,10 @@ func TestFactoryNewTmpfs(t *testing.T) {
if m.Source != "tmpfs" {
t.Fatalf("Source of root: %s, expected %s", m.Source, "tmpfs")
}
unix.Unmount(root, unix.MNT_DETACH)
err = unix.Unmount(root, unix.MNT_DETACH)
if err != nil {
t.Error("failed to unmount root:", err)
}
}
func TestFactoryLoadNotExists(t *testing.T) {
@@ -130,7 +133,7 @@ func TestFactoryLoadNotExists(t *testing.T) {
if rerr != nil {
t.Fatal(rerr)
}
defer os.RemoveAll(root)
defer os.RemoveAll(root) //nolint: errcheck
factory, err := New(root, Cgroupfs)
if err != nil {
t.Fatal(err)
@@ -153,7 +156,7 @@ func TestFactoryLoadContainer(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(root)
defer os.RemoveAll(root) //nolint: errcheck
// setup default container config and state for mocking
var (
id = "1"
@@ -219,7 +222,7 @@ func marshal(path string, v interface{}) error {
if err != nil {
return err
}
defer f.Close()
defer f.Close() //nolint: errcheck
return utils.WriteJSON(f, v)
}