Golang conventions: Difference between revisions
From wikinotes
(Created page with "= Naming = <blockquote> == Casing == <blockquote> <syntaxhighlight lang="go"> func DoThing() { ... } // exported functions are PascalCase func doThing() { ... } // regular f...") |
No edit summary |
||
Line 21: | Line 21: | ||
</blockquote><!-- Interfaces --> | </blockquote><!-- Interfaces --> | ||
</blockquote><!-- Naming --> | </blockquote><!-- Naming --> | ||
= Spacing = | |||
<blockquote> | |||
TODO | |||
</blockquote><!-- Spacing --> | |||
= Syntax = | = Syntax = |
Revision as of 03:35, 25 May 2022
Naming
Casing
func DoThing() { ... } // exported functions are PascalCase func doThing() { ... } // regular functions are camelCaseInterfaces
// interfaces should end in 'er' (or similar) Writer, Reader, Formatter, Notifier, Flusher, Stringer // implementations of interfaces should drop the 'er' Write, Read, Format, Notify, Flush, String
Spacing
TODO
Syntax
Semicolons
Go uses semicolons as line-endings, but prefers that the semicolon is implied automatically.