Golang

Go Code Review Comments

https://github.com/golang/go/wiki/CodeReviewCommentshttps://google.github.io/styleguide/go/decisions#variable-nameshttps://www.cnblogs.com/xuweiqiang/p/15337132.htmlGood code specification is conducive to code maintenance. Since the specification requires too many requirements, the mandatory code specification is simplified into the following points:

  1. All exported methods, exported custom structures or interfaces need to be annotated.

  2. Logically complex areas require comments, the more detailed the better

  3. Each row cannot exceed 120 columns

  4. Each function cannot exceed 80 lines

  5. The same file cannot exceed 800 lines

  6. Cyclomatic complexity cannot exceed 15

  7. The nesting depth cannot exceed 4 levels.

  8. Code must be formatted with gofmt

  9. Follow naming conventions (including variables, constants, etc.)

  10. If the magic number appears more than 3 times, usage is prohibited.

notes:Please use English for all commentsThe above 10 points are mandatory requirements, but we encourage everyone to follow the code specifications as much as possibleI recommend installing golangci-lint locally and running checks before each code submission. Only proceed with the submission if it passes the checks.


Framework - GoFrame

https://goframe.org/pages/viewpage.action?pageId=1114119advantage:

  1. Leading in the industry and complete in engineering

  2. Modular, loosely coupled design, high performance

  3. Rich in components (It covers almost all the components that can be used in backend development.), ready to use out of the box.

  4. Simple and user-friendly, with detailed documentation

  5. Interfacing and high scalability design

  6. Full end-to-end tracing capability.

  7. Full error stack trace feature.

  8. Interface-based error code support.

  9. Robust engineering design standards (helpful for beginners to develop good coding habits, learn advanced design principles, and facilitate better project maintenance)."

  10. More convenient and powerful ORM components

  11. Convenient development tools and automated code generation

  12. Support OpenTelemetry observability standard

  13. Automated interface document generation, supporting OpenAPIV3 standard

  14. Engineering design is very suitable for language transformation such as PHP and JAVA

Disadvantage: The document is in Chinese and requires translation software

Last updated