github.com/goplus/gop@v1.2.6/printer/_testdata/04-Func/func.gop (about)

     1  import (
     2  	"fmt"
     3  	"strings"
     4  )
     5  
     6  func foo(x string) string {
     7  	return strings.NewReplacer("?", "!").Replace(x)
     8  }
     9  
    10  func printf(format string, args ...interface{}) (n int, err error) {
    11  	n, err = fmt.Printf(format, args...)
    12  	return
    13  }
    14  
    15  func bar(foo func(string, ...interface{}) (int, error)) {
    16  	foo("Hello, %v!\n", "Go+")
    17  }
    18  
    19  bar(printf)
    20  fmt.Println(foo("Hello, world???"))
    21  fmt.Println(printf("Hello, %v\n", "Go+"))