blob: 7980c8d1067190ad6d38b455d3f9949889d6c4f7 [file] [log] [blame]
// Test for allowed errors.New(fmt.Sprintf()) when a custom errors package is imported.
// Package foo ...
package foo
import (
"fmt"
"github.com/pkg/errors"
)
func f(x int) error {
if x > 10 {
return errors.New(fmt.Sprintf("something %d", x)) // OK
}
if x > 5 {
return errors.New(g("blah")) // OK
}
if x > 4 {
return errors.New("something else") // OK
}
return nil
}
func g(s string) string { return "prefix: " + s }