Module lessons (1/5)
Naming convention and style
PascalCase for export, camelCase for local, short names in short scopes, gofmt is out of the question.
What you'll learn in this lesson
- Adjust the visibility of uppercase/lowercase symbols without the
public/privatekeyword. - Apply
CamelCaseand consistent capitalization of acronyms (HTTPClient,userID,URL). - Choose concise names for local variables, method receivers, and interfaces
-er. - Keep package names short and use
gofmt,goimports, andgo vet.
Overview
Go's style isn't left to individual preferences: it's hard-coded into community conventions and automatically applied by gofmt. Writing idiomatic Go means producing code that any other language developer can read instantly.
There are no qualifiers like public or private in Go - only the first letter of the identifier within the package counts.
Sections covered in this lesson
- 1Visibility through initial
- 2CamelCase, never
snake_case, consistent acronyms - 3Short Receivers, Scopes and Interfaces
-er - 4Automatic toolchain before each commit
- 5Guided practice
- 6Check for understanding
Unlock "Naming convention and style" and the full Course Go curriculum
PascalCase for export, camelCase for local, short names in short scopes, `gofmt` is out of the question.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course Go plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.