diff --git a/go.mod b/go.mod index b37c27f..dde725c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.21 require ( github.com/docker/docker v24.0.9+incompatible github.com/elastic/go-windows v1.0.0 - github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 github.com/prometheus/procfs v0.8.0 github.com/stretchr/testify v1.7.0 golang.org/x/sys v0.13.0 diff --git a/go.sum b/go.sum index 37e10a5..9c75f89 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4= -github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= diff --git a/providers/aix/host_aix_ppc64.go b/providers/aix/host_aix_ppc64.go index dafe062..059a5f0 100644 --- a/providers/aix/host_aix_ppc64.go +++ b/providers/aix/host_aix_ppc64.go @@ -37,8 +37,6 @@ import ( "strings" "time" - "github.com/joeshaw/multierror" - "github.com/elastic/go-sysinfo/internal/registry" "github.com/elastic/go-sysinfo/providers/shared" "github.com/elastic/go-sysinfo/types" @@ -167,7 +165,7 @@ func (r *reader) addErr(err error) bool { func (r *reader) Err() error { if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} + return errors.Join(r.errs...) } return nil } diff --git a/providers/darwin/host_darwin.go b/providers/darwin/host_darwin.go index 4a6adc1..933959b 100644 --- a/providers/darwin/host_darwin.go +++ b/providers/darwin/host_darwin.go @@ -27,8 +27,6 @@ import ( "strings" "time" - "github.com/joeshaw/multierror" - "github.com/elastic/go-sysinfo/internal/registry" "github.com/elastic/go-sysinfo/providers/shared" "github.com/elastic/go-sysinfo/types" @@ -194,7 +192,7 @@ func (r *reader) addErr(err error) bool { func (r *reader) Err() error { if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} + return errors.Join(r.errs...) } return nil } diff --git a/providers/linux/host_linux.go b/providers/linux/host_linux.go index 2e0d604..d2f0875 100644 --- a/providers/linux/host_linux.go +++ b/providers/linux/host_linux.go @@ -27,7 +27,6 @@ import ( "strings" "time" - "github.com/joeshaw/multierror" "github.com/prometheus/procfs" "github.com/elastic/go-sysinfo/internal/registry" @@ -185,7 +184,7 @@ func (r *reader) addErr(err error) bool { func (r *reader) Err() error { if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} + return errors.Join(r.errs...) } return nil } diff --git a/providers/linux/os.go b/providers/linux/os.go index f5b02be..17956f9 100644 --- a/providers/linux/os.go +++ b/providers/linux/os.go @@ -20,6 +20,7 @@ package linux import ( "bufio" "bytes" + "errors" "fmt" "os" "path/filepath" @@ -27,8 +28,6 @@ import ( "strconv" "strings" - "github.com/joeshaw/multierror" - "github.com/elastic/go-sysinfo/types" ) @@ -207,11 +206,11 @@ func makeOSInfo(osRelease map[string]string) (*types.OSInfo, error) { } func findDistribRelease(baseDir string) (*types.OSInfo, error) { - var errs []error matches, err := filepath.Glob(filepath.Join(baseDir, distribRelease)) if err != nil { return nil, err } + var errs []error for _, path := range matches { if strings.HasSuffix(path, osRelease) || strings.HasSuffix(path, lsbRelease) { continue @@ -229,7 +228,7 @@ func findDistribRelease(baseDir string) (*types.OSInfo, error) { } return osInfo, err } - return nil, fmt.Errorf("no valid /etc/-release file found: %w", &multierror.MultiError{Errors: errs}) + return nil, fmt.Errorf("no valid /etc/-release file found: %w", errors.Join(errs...)) } func getDistribRelease(file string) (*types.OSInfo, error) { diff --git a/providers/windows/host_windows.go b/providers/windows/host_windows.go index e476778..8cbc2ba 100644 --- a/providers/windows/host_windows.go +++ b/providers/windows/host_windows.go @@ -26,8 +26,6 @@ import ( "syscall" "time" - "github.com/joeshaw/multierror" - stdwindows "golang.org/x/sys/windows" windows "github.com/elastic/go-windows" @@ -129,7 +127,7 @@ func (r *reader) addErr(err error) bool { func (r *reader) Err() error { if len(r.errs) > 0 { - return &multierror.MultiError{Errors: r.errs} + return errors.Join(r.errs...) } return nil }