1. 4.1 unittesthistorical

    1. 是什么 单元测试 2. 使用 - 文件名 xxx test.go - 导入 testing - 函数名必须 TestXXX - 运行 - go test . 3. 参考 - Go语言基础之单元测试 \ 李文周的博客 - testing \- The Go Programming Languag

  2. 4.2 pprofhistorical

    1. pprof是什么 Golang的性能分析工具。 2. 如何使用pprof 有两个库: runtime/pprof :采集工具型应用运行数据进行分析 net/http/pprof :采集web应用运行时数据进行分析 benchmark :压测 2.1. runtime/pprof 2.1.1.

  3. 4.3 benchmarkhistorical

    1. 使用 - bench.go - bench test.go - 测试: - go test -bench=. - 查看内存分配信息: go test -bench=. -benchmem - 生成CPU信息: go test -bench=. -benchmem -cpuprofile pro

  4. 4.4 Golang内存泄露historical

    1. 内存泄露 内存泄露.md 2. Golang内存泄露 2.1. root对象引用 2.2. goroutine 泄漏 goroutine泄露:原理、场景、检测和防范 \- SegmentFault 思否 - 如果你启动了一个 goroutine,但并没有符合预期的退出,那么直到程序结束这个go

  5. 4.5 tracehistorical

    1. 使用 步骤如下: 1. 导入包: import runtime/trace 2. 开启分析: trace.Start(file) 停止分析: trace.Stop() 3. 命令行分析 - go tool trace trace.out - 2. 参考 Go execution tracer