Skip to main content
Module 10 · Lesson 1 of 546/50 in the course~10 min
Module lessons (1/5)

Naming convention and style

Lesson preview5 hands-on exercises readyCourse Go · Module 10 — Idiomatic practice

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/private keyword.
  • Apply CamelCase and 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, and go 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

  1. 1Visibility through initial
  2. 2CamelCase, never snake_case, consistent acronyms
  3. 3Short Receivers, Scopes and Interfaces -er
  4. 4Automatic toolchain before each commit
  5. 5Guided practice
  6. 6Check for understanding
Pro Lesson · Module 10 — Idiomatic practice

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.