diff --git a/providers/os/connection/docker/container_connection.go b/providers/os/connection/docker/container_connection.go index 940e257edc..779c2562c0 100644 --- a/providers/os/connection/docker/container_connection.go +++ b/providers/os/connection/docker/container_connection.go @@ -342,14 +342,18 @@ func NewWithReader(id uint32, conf *inventory.Config, asset *inventory.Asset, rc } } - return tar.NewTarConnectionWithClose(id, &inventory.Config{ - Type: "tar", - Runtime: "docker-image", - Options: map[string]string{ - tar.OPTION_FILE: filename, + return tar.NewTarConnection( + id, + &inventory.Config{ + Type: "tar", + Runtime: "docker-image", + Options: map[string]string{ + tar.OPTION_FILE: filename, + }, }, - }, asset, func() { - log.Debug().Str("tar", filename).Msg("tar> remove temporary tar file on connection close") - os.Remove(filename) - }) + asset, + tar.WithCloseFn(func() { + log.Debug().Str("tar", filename).Msg("tar> remove temporary tar file on connection close") + os.Remove(filename) + })) } diff --git a/providers/os/connection/docker/snapshot_connection.go b/providers/os/connection/docker/snapshot_connection.go index 2d7732c8ed..05ba0bf2b1 100644 --- a/providers/os/connection/docker/snapshot_connection.go +++ b/providers/os/connection/docker/snapshot_connection.go @@ -19,7 +19,7 @@ type DockerSnapshotConnection struct { } func NewDockerSnapshotConnection(id uint32, conf *inventory.Config, asset *inventory.Asset) (*DockerSnapshotConnection, error) { - tarConnection, err := tar.NewTarConnectionWithClose(id, conf, asset, func() {}) + tarConnection, err := tar.NewTarConnection(id, conf, asset) if err != nil { return nil, err } @@ -42,15 +42,19 @@ func NewFromDockerEngine(id uint32, conf *inventory.Config, asset *inventory.Ass return nil, err } - tarConnection, err := tar.NewTarConnectionWithClose(id, &inventory.Config{ - Type: "tar", - Options: map[string]string{ - tar.OPTION_FILE: f.Name(), + tarConnection, err := tar.NewTarConnection( + id, + &inventory.Config{ + Type: "tar", + Options: map[string]string{ + tar.OPTION_FILE: f.Name(), + }, }, - }, asset, func() { - // remove temporary file on stream close - os.Remove(f.Name()) - }) + asset, + tar.WithCloseFn(func() { + // remove temporary file on stream close + os.Remove(f.Name()) + })) if err != nil { return nil, err } diff --git a/providers/os/connection/fs/filesystem_test.go b/providers/os/connection/fs/filesystem_test.go index 5d6940ccdc..0a5df722ad 100644 --- a/providers/os/connection/fs/filesystem_test.go +++ b/providers/os/connection/fs/filesystem_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/require" "go.mondoo.com/cnquery/v10/providers-sdk/v1/inventory" "go.mondoo.com/cnquery/v10/providers/os/connection/fs" - "go.mondoo.com/cnquery/v10/providers/os/connection/fs/fsutil" "go.mondoo.com/cnquery/v10/providers/os/detector" + "go.mondoo.com/cnquery/v10/providers/os/fsutil" ) func TestOsDetection(t *testing.T) {