diff --git a/logger/debug.go b/logger/debug.go index 8ff3a03b0a..e8983789ca 100644 --- a/logger/debug.go +++ b/logger/debug.go @@ -6,7 +6,6 @@ package logger import ( "encoding/json" "fmt" - "io/ioutil" "os" "github.com/hokaccha/go-prettyjson" @@ -59,7 +58,7 @@ func DebugDumpJSON(name string, obj interface{}) { log.Error().Err(err).Msg("failed to dump JSON") } - err = ioutil.WriteFile(DumpLocal+name+".json", []byte(raw), 0644) + err = os.WriteFile(DumpLocal+name+".json", []byte(raw), 0o644) if err != nil { log.Error().Err(err).Msg("failed to dump JSON") } @@ -85,7 +84,7 @@ func DebugDumpYAML(name string, obj interface{}) { log.Error().Err(err).Msg("failed to dump YAML") } - err = ioutil.WriteFile(DumpLocal+name+".yaml", []byte(raw), 0644) + err = os.WriteFile(DumpLocal+name+".yaml", []byte(raw), 0o644) if err != nil { log.Error().Err(err).Msg("failed to dump JSON") } diff --git a/providers-sdk/v1/inventory/inventory_test.go b/providers-sdk/v1/inventory/inventory_test.go index be9ce22204..8175ab9671 100644 --- a/providers-sdk/v1/inventory/inventory_test.go +++ b/providers-sdk/v1/inventory/inventory_test.go @@ -45,7 +45,7 @@ func TestPreprocess(t *testing.T) { //data, err := inventory.ToYAML() //require.NoError(t, err) // - //err = ioutil.WriteFile("./testdata/inventory.parsed.yml", data, 0o700) + //err = os.WriteFile("./testdata/inventory.parsed.yml", data, 0o700) //require.NoError(t, err) }) diff --git a/providers-sdk/v1/lr/cli/cmd/docs.go b/providers-sdk/v1/lr/cli/cmd/docs.go index f918cdddae..6d3b14fb6e 100644 --- a/providers-sdk/v1/lr/cli/cmd/docs.go +++ b/providers-sdk/v1/lr/cli/cmd/docs.go @@ -6,7 +6,6 @@ package cmd import ( "encoding/json" "fmt" - "io/ioutil" "os" "path" "path/filepath" @@ -137,7 +136,7 @@ var docsYamlCmd = &cobra.Command{ } log.Info().Str("file", filepath).Msg("write file") - err = ioutil.WriteFile(filepath, data, 0o700) + err = os.WriteFile(filepath, data, 0o700) if err != nil { log.Fatal().Err(err).Msg("could not write docs file") } diff --git a/providers/arista/resources/eos/config_test.go b/providers/arista/resources/eos/config_test.go index ef5df61678..098a2afa40 100644 --- a/providers/arista/resources/eos/config_test.go +++ b/providers/arista/resources/eos/config_test.go @@ -7,7 +7,7 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" + "io" "os" "testing" @@ -39,7 +39,7 @@ func TestGetSection(t *testing.T) { require.NoError(t, err) defer f.Close() - data, err := ioutil.ReadAll(f) + data, err := io.ReadAll(f) require.NoError(t, err) section := GetSection(bytes.NewReader(data), "cvx service openstack") diff --git a/providers/gcp/connection/gcloud_config.go b/providers/gcp/connection/gcloud_config.go index db437e7dda..b7edc00efa 100644 --- a/providers/gcp/connection/gcloud_config.go +++ b/providers/gcp/connection/gcloud_config.go @@ -6,7 +6,6 @@ package connection import ( "encoding/json" "io" - "io/ioutil" ) // https://github.com/golang/oauth2/issues/241 @@ -34,7 +33,7 @@ func GetCurrentProject() (string, error) { func ParseGcloudConfig(r io.Reader) (GCloudConfig, error) { var gcloudconfig GCloudConfig - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return gcloudconfig, err } diff --git a/providers/k8s/connection/shared/resources/discovery.go b/providers/k8s/connection/shared/resources/discovery.go index d4581704c0..7751ef7f27 100644 --- a/providers/k8s/connection/shared/resources/discovery.go +++ b/providers/k8s/connection/shared/resources/discovery.go @@ -6,7 +6,7 @@ package resources import ( "context" "fmt" - "io/ioutil" + "io" "os" "sync" "time" @@ -29,7 +29,7 @@ func NewDiscovery(restConfig *rest.Config) (*Discovery, error) { // hide deprecation warnings for go api // see https://kubernetes.io/blog/2020/09/03/warnings/#customize-client-handling rest.SetDefaultWarningHandler( - rest.NewWarningWriter(ioutil.Discard, rest.WarningWriterOptions{}), + rest.NewWarningWriter(io.Discard, rest.WarningWriterOptions{}), ) dynClient, err := dynamic.NewForConfig(restConfig) diff --git a/providers/network/resources/dnsshake/dkim.go b/providers/network/resources/dnsshake/dkim.go index 5bf61bd72c..e441f121ab 100644 --- a/providers/network/resources/dnsshake/dkim.go +++ b/providers/network/resources/dnsshake/dkim.go @@ -8,7 +8,7 @@ import ( "crypto/x509" "encoding/base64" "errors" - "io/ioutil" + "io" "mime/quotedprintable" "strings" ) @@ -107,7 +107,7 @@ func NewDkimPublicKeyRepresentation(dkimRecord string) (*DkimPublicKeyRepresenta case "n": pkr.Notes = val // parse quote printable - qp, err := ioutil.ReadAll(quotedprintable.NewReader(strings.NewReader(val))) + qp, err := io.ReadAll(quotedprintable.NewReader(strings.NewReader(val))) if err == nil { pkr.Notes = string(qp) } diff --git a/providers/os/connection/container/docker_engine/command_test.go b/providers/os/connection/container/docker_engine/command_test.go index 68ab008211..5f70eb0566 100644 --- a/providers/os/connection/container/docker_engine/command_test.go +++ b/providers/os/connection/container/docker_engine/command_test.go @@ -9,7 +9,6 @@ package docker_engine import ( "context" "io" - "io/ioutil" "os" "testing" @@ -76,9 +75,9 @@ func TestDockerCommand(t *testing.T) { assert.Equal(t, "echo 'test'", cmd.Command, "they should be equal") assert.Equal(t, nil, err, "should execute without error") - stdout, _ := ioutil.ReadAll(cmd.Stdout) + stdout, _ := io.ReadAll(cmd.Stdout) assert.Equal(t, "test\n", string(stdout), "output should be correct") - stderr, _ := ioutil.ReadAll(cmd.Stderr) + stderr, _ := io.ReadAll(cmd.Stderr) assert.Equal(t, "", string(stderr), "output should be correct") }) @@ -91,10 +90,10 @@ func TestDockerCommand(t *testing.T) { assert.Equal(t, "echo 'This message goes to stderr' >&2", cmd.Command, "they should be equal") assert.Equal(t, nil, err, "should execute without error") - stdout, _ := ioutil.ReadAll(cmd.Stdout) + stdout, _ := io.ReadAll(cmd.Stdout) assert.Equal(t, "", string(stdout), "output should be correct") - stderr, _ := ioutil.ReadAll(cmd.Stderr) + stderr, _ := io.ReadAll(cmd.Stderr) assert.Equal(t, "This message goes to stderr\n", string(stderr), "output should be correct") }) } diff --git a/providers/os/connection/ssh/scp/fs.go b/providers/os/connection/ssh/scp/fs.go index a295fccf0c..12619110af 100644 --- a/providers/os/connection/ssh/scp/fs.go +++ b/providers/os/connection/ssh/scp/fs.go @@ -72,7 +72,7 @@ func (s Fs) Rename(oldname, newname string) error { } func (s Fs) Stat(path string) (os.FileInfo, error) { - // NOTE we cannot use s.scpClient.Receive(path, ioutil.Discard) since it would not work with directories + // NOTE we cannot use s.scpClient.Receive(path, io.Discard) since it would not work with directories return statutil.New(s.commandRunner).Stat(path) } diff --git a/providers/os/connection/ssh/scp/fs_file.go b/providers/os/connection/ssh/scp/fs_file.go index c7039ad4cd..25d94cd9f9 100644 --- a/providers/os/connection/ssh/scp/fs_file.go +++ b/providers/os/connection/ssh/scp/fs_file.go @@ -6,7 +6,7 @@ package scp import ( "bytes" "errors" - "io/ioutil" + "io" "os" scp_client "github.com/hnakamur/go-scp" @@ -44,7 +44,7 @@ func (f *File) Name() string { } func (f *File) Stat() (os.FileInfo, error) { - return f.scpClient.Receive(f.path, ioutil.Discard) + return f.scpClient.Receive(f.path, io.Discard) } func (f *File) Sync() error { diff --git a/providers/os/resources/groups/ps1getlocalgroup.go b/providers/os/resources/groups/ps1getlocalgroup.go index 6802283a5c..735a41b4f9 100644 --- a/providers/os/resources/groups/ps1getlocalgroup.go +++ b/providers/os/resources/groups/ps1getlocalgroup.go @@ -6,7 +6,6 @@ package groups import ( "encoding/json" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" "go.mondoo.com/cnquery/providers/os/resources/powershell" @@ -27,7 +26,7 @@ type WindowsLocalGroup struct { } func ParseWindowsLocalGroups(r io.Reader) ([]WindowsLocalGroup, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/iptables.go b/providers/os/resources/iptables.go index 64d3f3d657..bee2221f07 100644 --- a/providers/os/resources/iptables.go +++ b/providers/os/resources/iptables.go @@ -6,7 +6,7 @@ package resources import ( "errors" "fmt" - "io/ioutil" + "io" "net" "strconv" "strings" @@ -42,12 +42,12 @@ func (i *mqlIptables) output() ([]interface{}, error) { if err != nil { return nil, err } - data, err := ioutil.ReadAll(cmd.Stdout) + data, err := io.ReadAll(cmd.Stdout) if err != nil { return nil, err } if cmd.ExitStatus != 0 { - outErr, _ := ioutil.ReadAll(cmd.Stderr) + outErr, _ := io.ReadAll(cmd.Stderr) return nil, errors.New(string(outErr)) } lines := getLines(string(data)) @@ -86,12 +86,12 @@ func (i *mqlIptables) input() ([]interface{}, error) { if err != nil { return nil, err } - data, err := ioutil.ReadAll(cmd.Stdout) + data, err := io.ReadAll(cmd.Stdout) if err != nil { return nil, err } if cmd.ExitStatus != 0 { - outErr, _ := ioutil.ReadAll(cmd.Stderr) + outErr, _ := io.ReadAll(cmd.Stderr) return nil, errors.New(string(outErr)) } lines := getLines(string(data)) @@ -130,12 +130,12 @@ func (i *mqlIp6tables) output() ([]interface{}, error) { if err != nil { return nil, err } - data, err := ioutil.ReadAll(cmd.Stdout) + data, err := io.ReadAll(cmd.Stdout) if err != nil { return nil, err } if cmd.ExitStatus != 0 { - outErr, _ := ioutil.ReadAll(cmd.Stderr) + outErr, _ := io.ReadAll(cmd.Stderr) return nil, errors.New(string(outErr)) } lines := getLines(string(data)) @@ -174,13 +174,13 @@ func (i *mqlIp6tables) input() ([]interface{}, error) { if err != nil { return nil, err } - data, err := ioutil.ReadAll(cmd.Stdout) + data, err := io.ReadAll(cmd.Stdout) if err != nil { return nil, err } if cmd.ExitStatus != 0 { - outErr, _ := ioutil.ReadAll(cmd.Stderr) + outErr, _ := io.ReadAll(cmd.Stderr) return nil, errors.New(string(outErr)) } lines := getLines(string(data)) diff --git a/providers/os/resources/kernel/info.go b/providers/os/resources/kernel/info.go index d603062137..93467e9f1b 100644 --- a/providers/os/resources/kernel/info.go +++ b/providers/os/resources/kernel/info.go @@ -4,11 +4,11 @@ package kernel import ( - "github.com/cockroachdb/errors" "io" - "io/ioutil" "regexp" "strings" + + "github.com/cockroachdb/errors" ) var LINUX_KERNEL_ARGUMENTS_REGEX = regexp.MustCompile(`(?:^BOOT_IMAGE=([^\s]*)\s)?(?:root=([^\s]*)\s)?(.*)`) @@ -24,7 +24,7 @@ func ParseLinuxKernelArguments(r io.Reader) (LinuxKernelArguments, error) { Arguments: map[string]string{}, } - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return res, err } @@ -57,8 +57,7 @@ func ParseLinuxKernelArguments(r io.Reader) (LinuxKernelArguments, error) { // kernel version includes the kernel version, build data, buildhost, compiler version and an optional build date func ParseLinuxKernelVersion(r io.Reader) (string, error) { - - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return "", err } diff --git a/providers/os/resources/kernel/manager.go b/providers/os/resources/kernel/manager.go index 46c384b424..449cbaaadd 100644 --- a/providers/os/resources/kernel/manager.go +++ b/providers/os/resources/kernel/manager.go @@ -5,7 +5,6 @@ package kernel import ( "io" - "io/ioutil" "os" "strings" @@ -174,7 +173,7 @@ func (s *OSXKernelManager) Info() (KernelInfo, error) { return KernelInfo{}, errors.Wrap(err, "could not read kernel parameters") } - data, err := ioutil.ReadAll(cmd.Stdout) + data, err := io.ReadAll(cmd.Stdout) if err != nil { return KernelInfo{}, errors.Wrap(err, "could not read kernel parameters") } diff --git a/providers/os/resources/kernel/sysctl.go b/providers/os/resources/kernel/sysctl.go index 9cd89dca50..e1bd04ffff 100644 --- a/providers/os/resources/kernel/sysctl.go +++ b/providers/os/resources/kernel/sysctl.go @@ -7,7 +7,6 @@ import ( "archive/tar" "bufio" "io" - "io/ioutil" "strings" "github.com/rs/zerolog/log" @@ -47,7 +46,7 @@ func ParseLinuxSysctlProc(sysctlRootPath string, reader io.Reader) (map[string]s } if !h.FileInfo().IsDir() { - content, _ := ioutil.ReadAll(tr) + content, _ := io.ReadAll(tr) // remove leading sysctl path k := strings.Replace(h.Name, sysctlRootPath, "", -1) k = strings.Replace(k, "/", ".", -1) diff --git a/providers/os/resources/packages/cos_packages.go b/providers/os/resources/packages/cos_packages.go index 693ec239b6..76ff3aef47 100644 --- a/providers/os/resources/packages/cos_packages.go +++ b/providers/os/resources/packages/cos_packages.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" ) @@ -57,7 +56,7 @@ func (mpm *CosPkgManager) Available() (map[string]PackageUpdate, error) { } func ParseCosPackages(input io.Reader) ([]Package, error) { - data, err := ioutil.ReadAll(input) + data, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/packages/macos_packages.go b/providers/os/resources/packages/macos_packages.go index 32a706c733..b5137e42c3 100644 --- a/providers/os/resources/packages/macos_packages.go +++ b/providers/os/resources/packages/macos_packages.go @@ -6,7 +6,6 @@ package packages import ( "fmt" "io" - "io/ioutil" "strings" "github.com/cockroachdb/errors" @@ -25,7 +24,7 @@ func ParseMacOSPackages(input io.Reader) ([]Package, error) { // if the read seaker is not implemented lets cache stdout in-memory if !ok { - packageList, err := ioutil.ReadAll(input) + packageList, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/powershell.go b/providers/os/resources/powershell.go index 16ddb1d9d0..61f1ee5e0b 100644 --- a/providers/os/resources/powershell.go +++ b/providers/os/resources/powershell.go @@ -6,7 +6,6 @@ package resources import ( "bytes" "io" - "io/ioutil" "sync" "github.com/rs/zerolog/log" @@ -76,7 +75,7 @@ func convertToUtf8Encoding(out []byte) (string, error) { enc, name, _ := charset.DetermineEncoding(out, "") log.Trace().Str("encoding", name).Msg("check powershell results charset") r := transform.NewReader(bytes.NewReader(out), enc.NewDecoder()) - utf8out, err := ioutil.ReadAll(r) + utf8out, err := io.ReadAll(r) if err != nil { return "", err } diff --git a/providers/os/resources/procfs/processes.go b/providers/os/resources/procfs/processes.go index 3d11192b9c..eb65cab815 100644 --- a/providers/os/resources/procfs/processes.go +++ b/providers/os/resources/procfs/processes.go @@ -7,7 +7,6 @@ import ( "bufio" "bytes" "io" - "io/ioutil" "regexp" "strconv" "strings" @@ -95,7 +94,7 @@ func ParseProcessStatus(input io.Reader) (*LinuxProcessStatus, error) { } func ParseProcessCmdline(content io.Reader) (string, error) { - data, err := ioutil.ReadAll(content) + data, err := io.ReadAll(content) if err != nil { return "", err } diff --git a/providers/os/resources/reboot/rhel.go b/providers/os/resources/reboot/rhel.go index 9ee4535a31..e1a6845a9b 100644 --- a/providers/os/resources/reboot/rhel.go +++ b/providers/os/resources/reboot/rhel.go @@ -4,7 +4,7 @@ package reboot import ( - "io/ioutil" + "io" "strings" "go.mondoo.com/cnquery/providers/core/resources/versions/rpm" @@ -45,7 +45,7 @@ func (s *RpmNewestKernel) RebootPending() (bool, error) { return false, err } - unameR, err := ioutil.ReadAll(unamerCmd.Stdout) + unameR, err := io.ReadAll(unamerCmd.Stdout) if err != nil { return false, err } diff --git a/providers/os/resources/reboot/windows.go b/providers/os/resources/reboot/windows.go index f68d7d94ad..27653fe8c9 100644 --- a/providers/os/resources/reboot/windows.go +++ b/providers/os/resources/reboot/windows.go @@ -4,7 +4,7 @@ package reboot import ( - "io/ioutil" + "io" "strings" "go.mondoo.com/cnquery/providers/os/connection/shared" @@ -39,7 +39,7 @@ func (s *WinReboot) RebootPending() (bool, error) { return false, err } - content, err := ioutil.ReadAll(cmd.Stdout) + content, err := io.ReadAll(cmd.Stdout) if err != nil { return false, err } @@ -54,7 +54,7 @@ func (s *WinReboot) RebootPending() (bool, error) { return false, err } - content, err = ioutil.ReadAll(cmd.Stdout) + content, err = io.ReadAll(cmd.Stdout) if err != nil { return false, err } diff --git a/providers/os/resources/services/alpine_openrc.go b/providers/os/resources/services/alpine_openrc.go index 1c876550e5..f677d8432c 100644 --- a/providers/os/resources/services/alpine_openrc.go +++ b/providers/os/resources/services/alpine_openrc.go @@ -6,7 +6,6 @@ package services import ( "bufio" "io" - "io/ioutil" "path/filepath" "regexp" @@ -47,7 +46,7 @@ func (s *AlpineOpenrcServiceManager) List() ([]*Service, error) { } // if the rc-status command is installed - cmdOut, _ := ioutil.ReadAll(cmd.Stdout) + cmdOut, _ := io.ReadAll(cmd.Stdout) if string(cmdOut) != "" { cmd, err := s.conn.RunCommand("rc-status -s") if err != nil { diff --git a/providers/os/resources/services/launchd.go b/providers/os/resources/services/launchd.go index fa9d600701..3cdc0dbe4c 100644 --- a/providers/os/resources/services/launchd.go +++ b/providers/os/resources/services/launchd.go @@ -5,7 +5,6 @@ package services import ( "io" - "io/ioutil" "regexp" "go.mondoo.com/cnquery/providers/os/connection/shared" @@ -18,7 +17,7 @@ var LAUNCHD_REGEX = regexp.MustCompile(`(?m)^\s*([\d-]*)\s+(\d)\s+(.*)$`) // ^\s*([\d-]*)\s+(\d)\s+(.*)$ func ParseServiceLaunchD(input io.Reader) ([]*Service, error) { var services []*Service - content, err := ioutil.ReadAll(input) + content, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/services/ps1getservice.go b/providers/os/resources/services/ps1getservice.go index 07b544337c..1535a8e9ec 100644 --- a/providers/os/resources/services/ps1getservice.go +++ b/providers/os/resources/services/ps1getservice.go @@ -6,7 +6,6 @@ package services import ( "encoding/json" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" "go.mondoo.com/cnquery/providers/os/resources/powershell" @@ -103,7 +102,7 @@ func (s WindowsService) Service() *Service { } func ParseWindowsService(r io.Reader) ([]*Service, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/services/systemd.go b/providers/os/resources/services/systemd.go index 40b682fe58..2301ee95a2 100644 --- a/providers/os/resources/services/systemd.go +++ b/providers/os/resources/services/systemd.go @@ -8,7 +8,6 @@ import ( "fmt" "io" "io/fs" - "io/ioutil" "os" "path" "path/filepath" @@ -36,7 +35,7 @@ func ResolveSystemdServiceManager(conn shared.Connection) OSServiceManager { // a line may be prefixed with nothing, whitespace or a dot func ParseServiceSystemDUnitFiles(input io.Reader) ([]*Service, error) { var services []*Service - content, err := ioutil.ReadAll(input) + content, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/sshd/include.go b/providers/os/resources/sshd/include.go index 65e63944ac..df6519aa71 100644 --- a/providers/os/resources/sshd/include.go +++ b/providers/os/resources/sshd/include.go @@ -6,8 +6,8 @@ package sshd import ( "bufio" "fmt" + "io" "io/fs" - "io/ioutil" "path/filepath" "regexp" "strings" @@ -165,7 +165,7 @@ func readSshdConfig(filePath string, conn shared.Connection) ([]string, string, // so just consume the file's contents allFiles = append(allFiles, fullFilePath) - rawFile, err := ioutil.ReadAll(f) + rawFile, err := io.ReadAll(f) if err != nil { return nil, "", err } diff --git a/providers/os/resources/systemd/machineinfo.go b/providers/os/resources/systemd/machineinfo.go index 01018fdaa3..3cb0ab1fe8 100644 --- a/providers/os/resources/systemd/machineinfo.go +++ b/providers/os/resources/systemd/machineinfo.go @@ -5,14 +5,11 @@ package systemd import ( "io" - "io/ioutil" "regexp" "strings" ) -var ( - MACHINE_INFO_REGEX = regexp.MustCompile(`(?m)^\s*(.+?)\s*=\s*['"]?(.*?)['"]?\s*$`) -) +var MACHINE_INFO_REGEX = regexp.MustCompile(`(?m)^\s*(.+?)\s*=\s*['"]?(.*?)['"]?\s*$`) type MachineInfo struct { PrettyHostname string @@ -26,7 +23,7 @@ type MachineInfo struct { func ParseMachineInfo(r io.Reader) (MachineInfo, error) { res := MachineInfo{} - content, err := ioutil.ReadAll(r) + content, err := io.ReadAll(r) if err != nil { return res, err } diff --git a/providers/os/resources/uptime/unix.go b/providers/os/resources/uptime/unix.go index 28c03f3600..85e239d072 100644 --- a/providers/os/resources/uptime/unix.go +++ b/providers/os/resources/uptime/unix.go @@ -6,7 +6,6 @@ package uptime import ( "fmt" "io" - "io/ioutil" "regexp" "strconv" "strings" @@ -153,7 +152,7 @@ func (s *Unix) Duration() (time.Duration, error) { } func (s *Unix) parse(r io.Reader) (*UnixUptimeResult, error) { - content, err := ioutil.ReadAll(r) + content, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/uptime/windows.go b/providers/os/resources/uptime/windows.go index 1210b1b333..d4c4f7c4f3 100644 --- a/providers/os/resources/uptime/windows.go +++ b/providers/os/resources/uptime/windows.go @@ -6,7 +6,6 @@ package uptime import ( "encoding/json" "io" - "io/ioutil" "time" "go.mondoo.com/cnquery/providers/os/connection/shared" @@ -50,7 +49,7 @@ func (s *Windows) Duration() (time.Duration, error) { } func (s *Windows) parse(r io.Reader) (time.Duration, error) { - content, err := ioutil.ReadAll(r) + content, err := io.ReadAll(r) if err != nil { return 0, err } diff --git a/providers/os/resources/users/dscl.go b/providers/os/resources/users/dscl.go index 1a15692f01..5f7934cb7f 100644 --- a/providers/os/resources/users/dscl.go +++ b/providers/os/resources/users/dscl.go @@ -5,7 +5,6 @@ package users import ( "io" - "io/ioutil" "regexp" "strconv" @@ -16,7 +15,7 @@ import ( var USER_OSX_DSCL_REGEX = regexp.MustCompile(`(?m)^(\S*)\s*(.*)$`) func ParseDsclListResult(input io.Reader) (map[string]string, error) { - content, err := ioutil.ReadAll(input) + content, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/users/ps1getlocalusers.go b/providers/os/resources/users/ps1getlocalusers.go index ab9547f30d..16e015a1b6 100644 --- a/providers/os/resources/users/ps1getlocalusers.go +++ b/providers/os/resources/users/ps1getlocalusers.go @@ -6,7 +6,6 @@ package users import ( "encoding/json" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" "go.mondoo.com/cnquery/providers/os/resources/powershell" @@ -40,7 +39,7 @@ type WindowsLocalUser struct { } func ParseWindowsLocalUsers(r io.Reader) ([]WindowsLocalUser, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/bitlocker.go b/providers/os/resources/windows/bitlocker.go index 9f1c89a153..3a73d6c00c 100644 --- a/providers/os/resources/windows/bitlocker.go +++ b/providers/os/resources/windows/bitlocker.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" "go.mondoo.com/cnquery/providers/os/resources/powershell" @@ -153,7 +152,7 @@ func GetBitLockerVolumes(p shared.Connection) ([]bitlockerVolumeStatus, error) { func ParseWindowsBitlockerStatus(r io.Reader) ([]bitlockerVolumeStatus, error) { var volumeStatus []powershellBitlockerVolumeStatus - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/computerinfo.go b/providers/os/resources/windows/computerinfo.go index 8955906952..3f0fa87227 100644 --- a/providers/os/resources/windows/computerinfo.go +++ b/providers/os/resources/windows/computerinfo.go @@ -6,13 +6,12 @@ package windows import ( "encoding/json" "io" - "io/ioutil" ) const PSGetComputerInfo = "Get-ComputerInfo | ConvertTo-Json" func ParseComputerInfo(r io.Reader) (map[string]interface{}, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/env.go b/providers/os/resources/windows/env.go index 3bda9b2edd..5690186af3 100644 --- a/providers/os/resources/windows/env.go +++ b/providers/os/resources/windows/env.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" ) type WindowsEnv struct { @@ -15,7 +14,7 @@ type WindowsEnv struct { } func ParseEnv(r io.Reader) (map[string]interface{}, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/features.go b/providers/os/resources/windows/features.go index c593fff74d..0103254136 100644 --- a/providers/os/resources/windows/features.go +++ b/providers/os/resources/windows/features.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" ) const QUERY_FEATURES = "Get-WindowsFeature | Select-Object -Property Path,Name,DisplayName,Description,Installed,InstallState,FeatureType,DependsOn,Parent,SubFeatures | ConvertTo-Json" @@ -25,7 +24,7 @@ type WindowsFeature struct { } func ParseWindowsFeatures(input io.Reader) ([]WindowsFeature, error) { - data, err := ioutil.ReadAll(input) + data, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/firewall.go b/providers/os/resources/windows/firewall.go index 2e91c696bc..6c9512a4ab 100644 --- a/providers/os/resources/windows/firewall.go +++ b/providers/os/resources/windows/firewall.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" ) const ( @@ -60,7 +59,7 @@ type WindowsFirewallRule struct { } func ParseWindowsFirewallRules(input io.Reader) ([]WindowsFirewallRule, error) { - data, err := ioutil.ReadAll(input) + data, err := io.ReadAll(input) if err != nil { return nil, err } @@ -101,7 +100,7 @@ type WindowsFirewallSettings struct { } func ParseWindowsFirewallSettings(input io.Reader) (*WindowsFirewallSettings, error) { - data, err := ioutil.ReadAll(input) + data, err := io.ReadAll(input) if err != nil { return nil, err } @@ -145,7 +144,7 @@ type WindowsFirewallProfile struct { } func ParseWindowsFirewallProfiles(input io.Reader) ([]WindowsFirewallProfile, error) { - data, err := ioutil.ReadAll(input) + data, err := io.ReadAll(input) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/security_health.go b/providers/os/resources/windows/security_health.go index 8019d5e6df..1a08a5e63e 100644 --- a/providers/os/resources/windows/security_health.go +++ b/providers/os/resources/windows/security_health.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" "go.mondoo.com/cnquery/providers/os/connection/shared" "go.mondoo.com/cnquery/providers/os/resources/powershell" @@ -94,7 +93,7 @@ func GetSecurityProviderHealth(p shared.Connection) (*windowsSecurityHealth, err } func ParseSecurityProviderHealth(r io.Reader) (*windowsSecurityHealth, error) { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/windows/security_products.go b/providers/os/resources/windows/security_products.go index ec8eebf6b7..8545e355b2 100644 --- a/providers/os/resources/windows/security_products.go +++ b/providers/os/resources/windows/security_products.go @@ -6,7 +6,6 @@ package windows import ( "encoding/json" "io" - "io/ioutil" "time" "go.mondoo.com/cnquery/providers/os/connection/shared" @@ -163,7 +162,7 @@ func GetSecurityProducts(p shared.Connection) ([]securityProduct, error) { func ParseWindowsSecurityProducts(r io.Reader) ([]securityProduct, error) { var psSecProducts powershelSecurityProducts - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return nil, err } diff --git a/providers/os/resources/yum/yum.go b/providers/os/resources/yum/yum.go index 51f4f30f7c..fdcd8781b9 100644 --- a/providers/os/resources/yum/yum.go +++ b/providers/os/resources/yum/yum.go @@ -20,7 +20,6 @@ import ( "bufio" "encoding/json" "io" - "io/ioutil" "regexp" "strings" ) @@ -69,7 +68,7 @@ const ( ) func ParseVariables(r io.Reader) (map[string]string, error) { - content, err := ioutil.ReadAll(r) + content, err := io.ReadAll(r) if err != nil { return nil, err }