Tento commit je obsažen v:
2020-09-29 16:27:16 -07:00
revize 700dcd90b1
2 změnil soubory, kde provedl 27 přidání a 0 odebrání
+4
Zobrazit soubor
@@ -0,0 +1,4 @@
# patterns
snippet repository. PRs welcome. doesn't need to run/compile, but cool if
it does.
+23
Zobrazit soubor
@@ -0,0 +1,23 @@
package main
// from https://www.youtube.com/watch?v=yeetIgNeIkc&t=1064s
import (
"log"
"time"
)
func main() {
stop := StartTimer("main")
time.Sleep(1 * time.Second)
defer stop()
}
func StartTimer(name string) func() {
t := time.Now()
log.Println(name, "started")
return func() {
d := time.Now().Sub(t)
log.Println(name, "took", d)
}
}