命名与代码风格:写出地道的 Go
命名在 Go 中不仅是风格偏好,更是接口契约的一部分:标识符首字母大写即为导出标识符,小写即为包级私有,该机制由编译器强制执行。标识符一经发布,即成为包对外接口的组成部分,后续更名的成本由所有调用方承担。因此,评审中遇到 GetName()、MAXRETRIES 这类命名,应要求更名。
11 min read
Loading…
Quote of the day · October 26 · 关于意义 · Rick and Morty
Nobody exists on purpose. Nobody belongs anywhere. Everybody's gonna die. Come watch TV?
Notes on Agent runtimes — design decisions laid open: why it is this way, what it costs, and when it stops being true.