Section 01
Packages & Imports
Every Go file begins with package name. All files in the same directory share one package. The package name is the namespace — short, lowercase, one word.
Package declaration and imports
☕ Java — class per file, reverse-domain package
◎ Go — package per folder, short name
Why Go does thisGo has no classes. The package IS the unit of organisation. Functions, types, and variables at the package level are the equivalent of static members in a Java utility class — except they are the default, not a special case.
Exported vs Unexported — capitalisation is the access modifier
☕ Java — keywords for visibility
◎ Go — capitalisation for visibility
Why Go does thisNo public/private/protected keywords. Capitalisation is the entire visibility system. Go has no protected — there is no inheritance. There are only two scopes: this package, or everyone.
→Package names: short, lowercase, single word —
handler not handlerService. Types: PascalCase. Unexported functions: camelCase. Acronyms stay uppercase: UserID not UserId.