2.1 Names
The names of Go functions, variables, constants, types, statement labels, and packages
follow a simple rule: a name begins with a letter (that is, anything that
Unicode deems a letter) or an underscore and may have any number of
additional letters, digits, and underscores.
Case matters: heapSort
and Heapsort
are different names.
Go has 25 keywords
like if
and switch
that may be used only where the syntax permits;
they can’t be used as names.
break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var
In addition, there are about three dozen predeclared
names like int
and true
for built-in constants, types, ...
Get The Go Programming Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.