Section 9 of 11

Packages, imports & layout

A package is a directory. Capitalization is the access modifier.

a real module
myapp/
  go.mod                     module github.com/me/myapp
  cmd/server/main.go         -> go build ./cmd/server   -> ./server
  cmd/migrate/main.go        -> go build ./cmd/migrate  -> ./migrate
  internal/store/store.go    COMPILER-ENFORCED private to this module
  pkg/                       optional, public, often skipped

Capitalization, structs, and the stdlib as namespace

go.dev playground

Try it: Rename Name to name and the json output loses the field — encoding/json can only see exported fields.