Go Packages: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:
=Packages as Encapsulation Mechanism=
=Packages as Encapsulation Mechanism=


=Package Structure=
=<span id='Package_Structure'></span>Declaring Packages=


=Consuming Packages=
=Consuming Packages=

Revision as of 00:05, 7 September 2023

Internal

Overview

A Go package is a collection of variables, functions and type definitions, such as structs, and interfaces.

Go modularization is build upon the concept of package. Packages provide a namespace for their names, and also the mechanisms to encapsulate code, hide implementation details and only expose features, such as variables, types or functions that are meant to be publicly consumed.

Packages as Namespaces

Packages as Encapsulation Mechanism

Declaring Packages

Consuming Packages