@@ -4,12 +4,13 @@ import (
44 "archive/tar"
55 "compress/gzip"
66 "encoding/json"
7+ "errors"
8+ "fmt"
79 "io"
810 "os"
911 "regexp"
1012 "strings"
1113
12- "github.com/pkg/errors"
1314 "github.com/sirupsen/logrus"
1415)
1516
@@ -27,7 +28,7 @@ func AnalyzeGatherBundle(bundlePath string) error {
2728 // open the bundle file for reading
2829 bundleFile , err := os .Open (bundlePath )
2930 if err != nil {
30- return errors . Wrap ( err , "could not open the gather bundle" )
31+ return fmt . Errorf ( "could not open the gather bundle: %w" , err )
3132 }
3233 defer bundleFile .Close ()
3334 return analyzeGatherBundle (bundleFile )
@@ -37,7 +38,7 @@ func analyzeGatherBundle(bundleFile io.Reader) error {
3738 // decompress the bundle
3839 uncompressedStream , err := gzip .NewReader (bundleFile )
3940 if err != nil {
40- return errors . Wrap ( err , "could not decompress the gather bundle" )
41+ return fmt . Errorf ( "could not decompress the gather bundle: %w" , err )
4142 }
4243 defer uncompressedStream .Close ()
4344
@@ -51,7 +52,7 @@ func analyzeGatherBundle(bundleFile io.Reader) error {
5152 break
5253 }
5354 if err != nil {
54- return errors . Wrap ( err , "encountered an error reading from the gather bundle" )
55+ return fmt . Errorf ( "encountered an error reading from the gather bundle: %w" , err )
5556 }
5657 if header .Typeflag != tar .TypeReg {
5758 continue
@@ -145,7 +146,7 @@ func analyzeService(r io.Reader) (analysis, error) {
145146 decoder := json .NewDecoder (r )
146147 t , err := decoder .Token ()
147148 if err != nil {
148- return a , errors . Wrap ( err , "service entries file does not begin with a token" )
149+ return a , fmt . Errorf ( "service entries file does not begin with a token: %w" , err )
149150 }
150151 delim , isDelim := t .(json.Delim )
151152 if ! isDelim {
@@ -158,7 +159,7 @@ func analyzeService(r io.Reader) (analysis, error) {
158159 for decoder .More () {
159160 entry := & Entry {}
160161 if err := decoder .Decode (entry ); err != nil {
161- return a , errors . Wrap ( err , "could not decode an entry in the service entries file" )
162+ return a , fmt . Errorf ( "could not decode an entry in the service entries file: %w" , err )
162163 }
163164
164165 // record a new start of the service
0 commit comments