package main import ( "fmt" "strings" "time" ) func main() { start := time.Now() defer func() { end := time.Now() fmt.Println(end.Sub(start)) }() s := "treeoneone" str := strings.Replace(s, "treeone", "forest", -1) fmt.Println(str) }