September 2017
Intermediate to advanced
466 pages
9h 33m
English
Private variables and functions are different from public ones in that they can be used and called only internally in a package. Controlling which functions and variables are public or not is also known as encapsulation.
Go follows a simple rule which states that functions, variables, types, and so on that begin with an uppercase letter are public, whereas functions, variables, types, and so on that begin with a lowercase letter are private. However, this rule does not affect package names.
To illustrate this, we will make some changes to the aSimplePackage.go module and add one private variable and one private ...
Read now
Unlock full access