Skip to content

Commit a278021

Browse files
committed
Removed dependency on github.com/pkg/errors
1 parent a148065 commit a278021

File tree

5 files changed

+8
-17
lines changed

5 files changed

+8
-17
lines changed

Diff for: go.mod

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ module github.com/arduino/go-paths-helper
22

33
go 1.21
44

5-
require (
6-
github.com/pkg/errors v0.9.1
7-
github.com/stretchr/testify v1.8.4
8-
)
5+
require github.com/stretchr/testify v1.8.4
96

107
require (
118
github.com/davecgh/go-spew v1.1.1 // indirect

Diff for: go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
22
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4-
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
53
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
64
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
75
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=

Diff for: gzip.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ package paths
3131

3232
import (
3333
"compress/gzip"
34+
"fmt"
3435
"io"
35-
36-
"github.com/pkg/errors"
3736
)
3837

3938
// GZip compress src with gzip and writes the compressed file on dst
@@ -45,25 +44,25 @@ import (
4544
func GUnzip(src, dest *Path) error {
4645
gzIn, err := src.Open()
4746
if err != nil {
48-
return errors.Wrap(err, "opening "+src.String())
47+
return fmt.Errorf("opening %s: %w", src, err)
4948
}
5049
defer gzIn.Close()
5150

5251
in, err := gzip.NewReader(gzIn)
5352
if err != nil {
54-
return errors.Wrap(err, "decoding "+src.String())
53+
return fmt.Errorf("decoding %s: %w", src, err)
5554
}
5655
defer in.Close()
5756

5857
out, err := dest.Create()
5958
if err != nil {
60-
return errors.Wrap(err, "creating "+dest.String())
59+
return fmt.Errorf("creating %s: %w", dest, err)
6160
}
6261
defer out.Close()
6362

6463
_, err = io.Copy(out, in)
6564
if err != nil {
66-
return errors.Wrap(err, "uncompressing "+dest.String())
65+
return fmt.Errorf("uncompressing %s: %w", dest, err)
6766
}
6867

6968
return nil

Diff for: paths.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import (
3838
"strings"
3939
"syscall"
4040
"time"
41-
42-
"github.com/pkg/errors"
4341
)
4442

4543
// Path represents a path
@@ -442,7 +440,7 @@ func WriteToTempFile(data []byte, dir *Path, prefix string) (res *Path, err erro
442440
if n, err := f.Write(data); err != nil {
443441
return nil, err
444442
} else if n < len(data) {
445-
return nil, errors.Errorf("could not write all data (written %d bytes out of %d)", n, len(data))
443+
return nil, fmt.Errorf("could not write all data (written %d bytes out of %d)", n, len(data))
446444
}
447445
return New(f.Name()), nil
448446
}

Diff for: process.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ package paths
3232
import (
3333
"bytes"
3434
"context"
35+
"errors"
3536
"io"
3637
"os"
3738
"os/exec"
38-
39-
"github.com/pkg/errors"
4039
)
4140

4241
// Process is representation of an external process run

0 commit comments

Comments
 (0)