github.com/xenophex/i18n4go@v0.2.7-0.20160907212557-40256cda157a/test_fixtures/rewrite_package/f_option/input_files/test_templated_strings.go (about)

     1  package input_files
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  func Templated() string {
     9  	name := "cruel"
    10  	myName := "evil"
    11  	fmt.Println("Hello {{.Name}} world!", name)
    12  	fmt.Println("Hello {{.Name}} world!, bye from {{.MyName}}", name, myName)
    13  	fmt.Println("Hello {{.Name}} world!", "Evil")
    14  
    15  	//These should not have a map[string]interface{}
    16  	fmt.Println("Hello {{Not complex}} world! I am", name)
    17  	fmt.Println("Hello {{}}", myName)
    18  
    19  	fmt.Println("Hello {{.Name}} world!", strings.ToUpper(name))
    20  	fmt.Println("Hello {{.Name}} world!", strings.ToUpper("Hi"))
    21  	fmt.Println("Hello {{.Name}} world! {{.Number}} times", name, 10)
    22  	fmt.Println("Hello {{.Name}} world! {{.Float}} times", name, 10.0)
    23  
    24  	fmt.Println("Hello {{.Name}} world!", strings.ToUpper("Hello {{.Name}} world!", strings.ToUpper(name)))
    25  
    26  	type something struct {
    27  	}
    28  
    29  	foo := something{}
    30  	strz := []string{"one", "two", "buckle my shoe"}
    31  	fmt.Println("Welp, that's a great {{.MyStruct}} how about a {{.Whatever}}", &foo, strz[2])
    32  
    33  	println("Hello {{.Name}} world!", name)
    34  	println("Hello {{.Name}} world! {{.Name}}", name, name)
    35  }