Im using gometalinter
on my project and for this code
errors.New(fmt.Sprintf("%s cmd.Std error: %s ", cp[1:], err))
im getting error should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint)
Any idea how to resolve this ?
I try with errors.New(fmt.Errorf("%s cmd.Std error: %s ", cp[1:], err))
and I got error cannot use fmtErrorf as type string
fmt.Errorf
returns an error
while errors.New
takes a string
that's why your code doesn't compile.
You can simply omit the errors.New
call or, since you're using the github.com/pkg/errors
package, you can use https://godoc.org/github.com/pkg/errors#Errorf.