golang检测func的实行时间

    t := time.Now()
    elapsed := time.Since(t)
    fmt.Println("app1 elapsed:", elapsed)
    //实行某些代码
    fmt.Println("app1 elapsed:", elapsed)

推荐阅读更多精彩内容