diff --git a/go.mod b/go.mod index b703ce4c..dcc7d81f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.21 require ( github.com/arduino/go-paths-helper v1.12.0 - github.com/pkg/errors v0.9.1 golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index f5217bde..54661645 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ github.com/arduino/go-paths-helper v1.12.0 h1:xizOQtI9iHdl19qXd1EmWg5i9W//2bOCOY github.com/arduino/go-paths-helper v1.12.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/pkg/integration/tldr.go b/pkg/integration/tldr.go index 40a4d91f..57e538fb 100644 --- a/pkg/integration/tldr.go +++ b/pkg/integration/tldr.go @@ -5,12 +5,12 @@ package integration import ( + "fmt" "io" "net/http" "strings" "github.com/arduino/go-paths-helper" - "github.com/pkg/errors" "github.com/roddhjav/apparmor.d/pkg/util" ) @@ -33,7 +33,7 @@ func (t Tldr) Download() error { if !gzPath.Exist() { resp, err := http.Get(t.Url) if err != nil { - return errors.Wrapf(err, "downloading %s", t.Url) + return fmt.Errorf("downloading %s: %w", t.Url, err) } defer resp.Body.Close() diff --git a/pkg/util/paths.go b/pkg/util/paths.go index f15c5671..f22d3713 100644 --- a/pkg/util/paths.go +++ b/pkg/util/paths.go @@ -7,12 +7,12 @@ package util import ( "archive/tar" "compress/gzip" + "fmt" "io" "path/filepath" "strings" "github.com/arduino/go-paths-helper" - "github.com/pkg/errors" ) // Either or not to extract the file @@ -29,18 +29,18 @@ func toExtrat(name string, subfolders []string) bool { func ExtratTo(src *paths.Path, dst *paths.Path, subfolders []string) error { gzIn, err := src.Open() if err != nil { - return errors.Wrapf(err, "opening %s", src) + return fmt.Errorf("opening %s: %w", src, err) } defer gzIn.Close() in, err := gzip.NewReader(gzIn) if err != nil { - return errors.Wrapf(err, "decoding %s", src) + return fmt.Errorf("decoding %s: %w", src, err) } defer in.Close() if err := dst.MkdirAll(); err != nil { - return errors.Wrapf(err, "creating %s", src) + return fmt.Errorf("creating %s: %w", src, err) } tarIn := tar.NewReader(in) @@ -60,10 +60,10 @@ func ExtratTo(src *paths.Path, dst *paths.Path, subfolders []string) error { path := dst.Join(filepath.Base(header.Name)) file, err := path.Create() if err != nil { - return errors.Wrapf(err, "creating %s", file.Name()) + return fmt.Errorf("creating %s: %w", file.Name(), err) } if _, err := io.Copy(file, tarIn); err != nil { - return errors.Wrapf(err, "extracting %s", file.Name()) + return fmt.Errorf("extracting %s: %w", file.Name(), err) } file.Close() }