1// Test for allowed errors.New(fmt.Sprintf()) when a custom errors package is imported. 2 3// Package foo ... 4package foo 5 6import ( 7 "fmt" 8 9 "github.com/pkg/errors" 10) 11 12func f(x int) error { 13 if x > 10 { 14 return errors.New(fmt.Sprintf("something %d", x)) // OK 15 } 16 if x > 5 { 17 return errors.New(g("blah")) // OK 18 } 19 if x > 4 { 20 return errors.New("something else") // OK 21 } 22 return nil 23} 24 25func g(s string) string { return "prefix: " + s } 26