Andrew's Digital Garden

Private and Public functions in Go

Go distinguishes between external and internal functions through spelling alone.

All public functions, types and variables must start with an uppercase letter. All private functions, types and variables must start with a lowercase letter.

That is why fmt.Println has a capital 'P'.

This counts for things like library functions, structs, etc.

[[go]]

Private and Public functions in Go