Go - Name

Card Puncher Data Processing


Language - Name (Program Entity) in Go.



  • “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.


The new function creates an unnamed variable.


  • 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)


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.

Documentation / Reference

Discover More
Card Puncher Data Processing
Go - New

The expression new(T): creates an unnamed variable of type T, initializes it to the zero value of T, and returns its address, which is a value of type T. new is a predeclared function, not a...
Card Puncher Data Processing
Go - Variable

in Go Either the type or the = expression part may be omitted, but not both. If: the type is omitted, it is determined by the initializer expression. the expression is omitted, the initial...

Share this page:
Follow us:
Task Runner