Prefix Unexported Globals with _
Prefix unexported top-level var
s and const
s with _
to make it clear whenthey are used that they are global symbols.
Exception: Unexported error values, which should be prefixed with err
.
Rationale: Top-level variables and constants have a package scope. Using ageneric name makes it easy to accidentally use the wrong value in a differentfile.
Bad | Good |
---|---|
|
|