[] Go golang Coding Standards Guide

Copyright: https://blog.csdn.net/qq_21852449/article/details/87909109

Go to work to come up from Java, Java objects and then spent a long time in the world, Go newcomer to the world of rain ignorant, it would be a little finishing standard library specification.
1. Project name
go try to lowercase project name plus any symbolic
2.package names
using meaningful lowercase letters, and try not to repeat the standard library
3. Variable
variable declaration using camelCase, do not use "_" multiple named on with
4 comment
line comment is the norm, generally used to package comment block comment or disable a lot of code
5.struct
struct variable declaration and initialization methods are employed to write multiple lines
6.recieved value type or a pointer type
function (d * D ) ... // d can be changed in the method body data
function (d D) ... // d does not change data in the method body
7. .go file
go all lowercase file name, can use underscores
8. the method name
camelCasing

Guess you like

Origin blog.csdn.net/qq_21852449/article/details/87909109