Go - Name

1 - About

Language - Name (Program Entity) in Go.

3 - Properties

3.1 - Name

  • “camel case”. Example: QuoteRuneToASCII and parseRequestLine but never quote_rune_to_ASCII or parse_request_line.
  • The letters of acronyms and initialisms like ASCII and HTML are always rendered in the same case, so a function might be called htmlEscape, HTMLEscape, or escapeHTML, but not escapeHtml.

3.2 - Unnamed

The new function creates an unnamed variable.

3.3 - Scope

  • Local: If an entity is declared within a function
  • Own Package: If declared outside of a function. The name of each package-level entity is visible not only throughout the source file that contains its declaration, but throughout all the files of the package.
  • Across package: The case of the first letter of a name determines its visibility across package boundaries.
    • If the name begins with an upper-case letter, it is exported (visible and accessible outside of its own package)

3.4 - Lifetime

The lifetime of a name (variable) is the interval of time during which it exists as the program executes.

  • The lifetime of a package-level variable is the entire execution of the program.
  • By contrast, local variables have dynamic lifetimes: a new instance is created each time the declaration statement is executed, and the variable lives on until it becomes unreachable, at which point its storage may be recycled. Function parameters and results are local variables too; they are created each time their enclosing function is called.

4 - Documentation / Reference

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap