mirror of
https://github.com/roddhjav/apparmor.d.git
synced 2024-11-14 23:43:56 +01:00
refractor: remove dependency on pkg/errors.
This commit is contained in:
parent
09cdf6158d
commit
d40985099c
1
go.mod
1
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
|
||||
)
|
||||
|
2
go.sum
2
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=
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user