2018-01-22 11:19:33 +02:00

23 lines
354 B
Go

package main
import (
"fmt"
"io"
"strings"
"github.com/imkira/go-interpol"
)
func main() {
toUpper := func(key string, w io.Writer) error {
_, err := w.Write([]byte(strings.ToUpper(key)))
return err
}
str, err := interpol.WithFunc("{foo} {bar}!!!", toUpper)
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Println(str)
}