Go Style: Difference between revisions
Jump to navigation
Jump to search
(→Naming) |
(→Naming) |
||
Line 21: | Line 21: | ||
* [[Go_Functions#Idiomatic_Function_Naming_Conventions|Idiomatic Function Naming Conventions]] | * [[Go_Functions#Idiomatic_Function_Naming_Conventions|Idiomatic Function Naming Conventions]] | ||
* [[Go_Structs#Idiomatic_Struct_Naming_Conventions|Idiomatic Struct Naming Conventions]] | * [[Go_Structs#Idiomatic_Struct_Naming_Conventions|Idiomatic Struct Naming Conventions]] | ||
* [[Go_Interfaces#Idiomatic_Interface_Naming_Conventions|Idiomatic Interface Naming Conventions]] |
Revision as of 19:01, 6 September 2023
External
- https://google.github.io/styleguide/go/
- https://go.dev/doc/effective_go
- https://github.com/golang/go/wiki/CodeReviewComments
Internal
Overview
The Go standard library is a good source of code examples, comments and style.
Naming
Naming is one of the most important aspects of Go development. Writing idiomatic Go requires understanding of its core naming principles.
Identifiers should use camel case: SomeColor
or someColor
, depending on whether they are visible outside the package or not. Do not use snake case some_color
.
Naming conventions: