funcを返すfunc

package main

import "log"

func newFunc(str string) func() string {
    return func() string {
        return str
    }
}

func main() {
    f := newFunc("hello")
    log.Print(f()) // "hello"が返る
}