TDD 测试驱动开发(Test-Driven Development) 先写测试函数 运行测试 (编译失败) 为运行测试函数编写最少的代码并检查失败时的输出 编写正确的代码让测试函数通过 重构 让它运作,使它正确,使它快速 运作:通过测试 正确:重构代码 快速:优化代码 没有运作且正确,不要妄图快速。 过早的优化是万恶之源 —— Donald Knuth 学习资料 官网 https://gobyexample.com/ https://studygolang.gitbook.io/learn-go-with-tests/ https://github.com/astaxie/build-web-application-with-golang https://github.com/unknwon/the-way-to-go_ZH_CN