diff --git a/sdk/bundles/bundle_test.go b/sdk/bundles/bundle_test.go index 39d4f4f..6f5081f 100644 --- a/sdk/bundles/bundle_test.go +++ b/sdk/bundles/bundle_test.go @@ -1,7 +1,6 @@ package bundles_test import ( - "io/ioutil" "os" "path/filepath" @@ -13,7 +12,7 @@ import ( var _ = Describe("Bundle", func() { Context("install", func() { PIt("installs packages from luet repos", func() { - dir, err := ioutil.TempDir("", "test") + dir, err := os.MkdirTemp("", "test") Expect(err).ToNot(HaveOccurred()) defer os.RemoveAll(dir) os.MkdirAll(filepath.Join(dir, "var", "tmp", "luet"), os.ModePerm) @@ -23,7 +22,7 @@ var _ = Describe("Bundle", func() { }) It("installs from container images", func() { - dir, err := ioutil.TempDir("", "test") + dir, err := os.MkdirTemp("", "test") Expect(err).ToNot(HaveOccurred()) defer os.RemoveAll(dir) err = RunBundles([]BundleOption{WithDBPath(dir), WithRootFS(dir), WithTarget("container://quay.io/mocaccino/extra:edgevpn-utils-0.15.0")}) diff --git a/sdk/bundles/bundles.go b/sdk/bundles/bundles.go index bee8f2f..21f309f 100644 --- a/sdk/bundles/bundles.go +++ b/sdk/bundles/bundles.go @@ -2,7 +2,6 @@ package bundles import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -143,7 +142,7 @@ type ContainerRunner struct{} func (l *ContainerRunner) Install(config *BundleConfig) error { - tempDir, err := ioutil.TempDir("", "containerrunner") + tempDir, err := os.MkdirTemp("", "containerrunner") if err != nil { return err } diff --git a/sdk/profile/build.go b/sdk/profile/build.go index b79f5db..2163c42 100644 --- a/sdk/profile/build.go +++ b/sdk/profile/build.go @@ -2,7 +2,7 @@ package profile import ( "fmt" - "io/ioutil" + "os" "strings" "github.com/kairos-io/kairos/pkg/utils" @@ -19,7 +19,7 @@ type profileFileStruct struct { } func BuildFlavor(flavor string, profileFile string, directory string) error { - dat, err := ioutil.ReadFile(profileFile) + dat, err := os.ReadFile(profileFile) if err != nil { return fmt.Errorf("error while reading profile: %w", err) @@ -55,7 +55,7 @@ func BuildFlavor(flavor string, profileFile string, directory string) error { func readProfilePackages(profile string, profileFile string) ([]string, error) { res := []string{} - dat, err := ioutil.ReadFile(profileFile) + dat, err := os.ReadFile(profileFile) if err != nil { return res, fmt.Errorf("error while reading profile: %w", err) } @@ -86,7 +86,7 @@ func readProfilePackages(profile string, profileFile string) ([]string, error) { func readCommonPackages(profileFile string) ([]string, error) { res := []string{} - dat, err := ioutil.ReadFile(profileFile) + dat, err := os.ReadFile(profileFile) if err != nil { return res, fmt.Errorf("error while reading profile: %w", err) } diff --git a/sdk/state/state.go b/sdk/state/state.go index 5bc36c6..39e3bad 100644 --- a/sdk/state/state.go +++ b/sdk/state/state.go @@ -3,7 +3,7 @@ package state import ( "encoding/json" "fmt" - "io/ioutil" + "os" "strings" "github.com/itchyny/gojq" @@ -59,7 +59,7 @@ func detectPartition(b *block.Partition) PartitionState { } func detectBoot() Boot { - cmdline, err := ioutil.ReadFile("/proc/cmdline") + cmdline, err := os.ReadFile("/proc/cmdline") if err != nil { return Unknown } diff --git a/sdk/system/cloudconfig.go b/sdk/system/cloudconfig.go index 088dbf8..8d64bd1 100644 --- a/sdk/system/cloudconfig.go +++ b/sdk/system/cloudconfig.go @@ -2,7 +2,6 @@ package system import ( "fmt" - "io/ioutil" "os" "path/filepath" @@ -45,7 +44,7 @@ func writeCloudConfig(oem state.PartitionState, cloudConfig, subpath, filename s machine.Umount(mountPath) //nolint:errcheck }() _ = os.MkdirAll(filepath.Join(mountPath, subpath), 0650) - return ioutil.WriteFile(filepath.Join(mountPath, subpath, fmt.Sprintf("%s.yaml", filename)), []byte(cloudConfig), 0650) + return os.WriteFile(filepath.Join(mountPath, subpath, fmt.Sprintf("%s.yaml", filename)), []byte(cloudConfig), 0650) } // WriteCloudConfigData adds cloud config data to oem (/oem or /usr/local/cloud-config, depending if OEM partition exists).