1package b 2 3import "fmt" 4 5// Wrapf is a printf wrapper. 6func Wrapf(format string, args ...interface{}) { // want Wrapf:"printfWrapper" 7 fmt.Sprintf(format, args...) 8} 9 10// Wrap is a print wrapper. 11func Wrap(args ...interface{}) { // want Wrap:"printWrapper" 12 fmt.Sprint(args...) 13} 14 15// NoWrap is not a wrapper. 16func NoWrap(format string, args ...interface{}) { 17} 18 19// Wrapf2 is another printf wrapper. 20func Wrapf2(format string, args ...interface{}) string { // want Wrapf2:"printfWrapper" 21 22 // This statement serves as an assertion that this function is a 23 // printf wrapper and that calls to it should be checked 24 // accordingly, even though the delegation below is obscured by 25 // the "("+format+")" operations. 26 if false { 27 fmt.Sprintf(format, args...) 28 } 29 30 // Effectively a printf delegation, 31 // but the printf checker can't see it. 32 return fmt.Sprintf("("+format+")", args...) 33} 34