Bladeren bron

remove unnecessary use of fmt.Sprintf (#217)

* remove unnecessary use of fmt.Sprintf
Adrian Perez 6 jaren geleden
bovenliggende
commit
004deef562
2 gewijzigde bestanden met toevoegingen van 2 en 2 verwijderingen
  1. 1 1
      example_test.go
  2. 1 1
      stack_test.go

+ 1 - 1
example_test.go

@@ -195,7 +195,7 @@ func Example_stackTrace() {
 func ExampleCause_printf() {
 	err := errors.Wrap(func() error {
 		return func() error {
-			return errors.Errorf("hello %s", fmt.Sprintf("world"))
+			return errors.New("hello world")
 		}()
 	}(), "failed")
 

+ 1 - 1
stack_test.go

@@ -142,7 +142,7 @@ func TestStackTrace(t *testing.T) {
 	}, {
 		Cause(func() error {
 			return func() error {
-				return Errorf("hello %s", fmt.Sprintf("world"))
+				return Errorf("hello %s", fmt.Sprintf("world: %s", "ooh"))
 			}()
 		}()), []string{
 			`github.com/pkg/errors.TestStackTrace.func2.1` +