02 2023 档案
摘要:1、configor 参考:configor配置文件工具 - ☞@_@ - 博客园 (cnblogs.com) 2、viper 参考:Go 读取 YAML 配置文件的两种方式 - 掘金 (juejin.cn)
阅读全文
摘要:func upload(w http.ResponseWriter, r *http.Request) { fmt.Println("method:", r.Method) // 获取请求的方法 if r.Method == "GET" { crutime := time.Now().Unix()
阅读全文
摘要:1、trace可以解决哪些问题 Goroutine 在执行时会做哪些操作? 执行/阻塞了多长时间? 在什么时候阻止? 在哪里被阻止的? 谁又锁/解锁了它们? GC 是怎么影响到 Goroutine 的执行的? 2、代码实例 package main import ( "os" "runtime/tr
阅读全文
摘要:1、代码实例 以下例子除了特别说明,都以这段代码为实例。 package main import ( "log" "time" "net/http" _ "net/http/pprof" ) var datas []string func main() { go func() { for { log
阅读全文
摘要:1、方法总结 sort.Ints sort.Floats sort.Strings sort.SliceStable sort.Interface{} 2、实例 //sort.Ints() s := []int{4, 2, 3, 1} sort.Ints(s) fmt.Println(s) // 输
阅读全文
摘要:type Season int const ( Summer Season = iota + 1 Autumn Winter Spring ) type ArticleState int const ( Draft ArticleState = iota + 1 Published Deleted
阅读全文