From 62f833fc9f6c4d3223bdb37bd0c2f8951bed8596 Mon Sep 17 00:00:00 2001 From: Jaana Burcu Dogan Date: Sat, 18 Mar 2017 17:29:31 -0700 Subject: [PATCH] remove dependencies to github.com/pkg/errors --- cmd.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd.go b/cmd.go index e8e6ffc..f7108ce 100644 --- a/cmd.go +++ b/cmd.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "io" "io/ioutil" @@ -12,7 +13,6 @@ import ( "github.com/google/gops/internal" "github.com/google/gops/signal" - "github.com/pkg/errors" ) var cmds = map[string](func(addr net.TCPAddr) error){ @@ -102,10 +102,9 @@ func pprof(addr net.TCPAddr, p byte) error { return err } { - out, err := cmd(addr, signal.BinaryDump) if err != nil { - return errors.New("couldn't retrieve running binary's dump") + return fmt.Errorf("failed to read the binary: %v", err) } if len(out) == 0 { return errors.New("failed to read the binary") @@ -144,14 +143,14 @@ func targetToAddr(target string) (*net.TCPAddr, error) { var err error addr, err := net.ResolveTCPAddr("tcp", target) if err != nil { - return nil, errors.Wrap(err, "couldn't parse dst address") + return nil, fmt.Errorf("couldn't parse dst address: %v", err) } return addr, nil } // try to find port by pid then, connect to local pid, err := strconv.Atoi(target) if err != nil { - return nil, errors.Wrap(err, "couldn't parse PID") + return nil, fmt.Errorf("couldn't parse PID: %v", err) } port, err := internal.GetPort(pid) addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:"+port) @@ -161,7 +160,7 @@ func targetToAddr(target string) (*net.TCPAddr, error) { func cmd(addr net.TCPAddr, c byte) ([]byte, error) { conn, err := cmdLazy(addr, c) if err != nil { - return nil, errors.Wrap(err, "couldn't get port by PID") + return nil, fmt.Errorf("couldn't get port by PID: %v", err) } all, err := ioutil.ReadAll(conn)