Use TitleCase for exported identifiers and lowercase for unexported ones to control visibility in Go.
Name Go identifiers using TitleCase for exported items and lowercase for unexported ones, matching the conventions seen in the standard library.
// Exported: visible outside the package
type Buffer struct {
buf []byte
}
// Unexported: private to the package
func (b *Buffer) reset() {
b.buf = b.buf[:0]
}
Use go fmt to automatically enforce these naming rules across your codebase.
In Go, capitalization controls visibility. If you start a name with a capital letter, it is public and accessible from other files. If you start with a lowercase letter, it is private and hidden from the outside world. Think of it like a house: capital letters are the front door anyone can use, while lowercase letters are the back door only you can access.