Go

Вызов из словаря

type fn func(string)

func func1(s string) {
}

calls := map[string]fn{
	"func1": func1,
}
calls["func1"]("Hello")

Прерывания клавиатуры Ctrl-C

func SetupCloseHandler() {
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		<-c
		os.Exit(0)
	}()
}

Windows console header

Last updated