From 614c0b8f9a5bb844a1e1ac857bebb824f64347bc Mon Sep 17 00:00:00 2001 From: assafmo Date: Thu, 25 Oct 2018 21:13:13 +0300 Subject: [PATCH] better wrap error messages --- main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 1e0adf2..5e52d69 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,6 @@ import ( "github.com/google/gopacket/layers" "github.com/google/gopacket/pcapgo" flags "github.com/jessevdk/go-flags" - "github.com/pkg/errors" ) const version = "0.8.8" @@ -57,7 +56,7 @@ func joincap(args []string) error { // if -h flag, help is printed by the library on exit return nil } - return errors.Wrap(err, "cmd flags error") + return fmt.Errorf("cmd flags error: %v", err) } // if -V flag, print version and exit @@ -74,14 +73,14 @@ func joincap(args []string) error { heap.Init(&minTimeHeap) linkType, err := initHeapWithInputFiles(cmdFlags.Rest.InFiles[1:], &minTimeHeap, cmdFlags.Verbose) if err != nil { - return err + return fmt.Errorf("cannot initiate merge: %v", err) } outputFile := os.Stdout if cmdFlags.OutputFilePath != "-" { outputFile, err = os.Create(cmdFlags.OutputFilePath) if err != nil { - return errors.Wrap(err, fmt.Sprintf("cannot open %s for writing", cmdFlags.OutputFilePath)) + return fmt.Errorf("cannot open %s for writing: %v", cmdFlags.OutputFilePath, err) } defer outputFile.Close() }