Go Packages: Difference between revisions
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
A Go package is a collection of [[Go_Language#Variables|variables]], [[Go_Functions|functions]] and [[Go_Language#Type|type]] definitions, such as [[Go_Structs#Overview|structs]], and [[Go_Interfaces#Override|interfaces]]. | A Go package is a collection of [[Go_Language#Variables|variables]], [[Go_Functions|functions]] and [[Go_Language#Type|type]] definitions, such as [[Go_Structs#Overview|structs]], and [[Go_Interfaces#Override|interfaces]]. | ||
Go modularization is build upon the concept of package. [[Go_Packages#Overview|Packages]] provide a [[Go_Packages#Packages_as_Namespaces|namespace]] for their names, and also the mechanisms to [[Go_Packages#Packages_as_Encapsulation_Mechanism|encapsulate]] code, hide implementation details and only expose features, such as [[Go_Language#Variables|variables]], [[Go_Language#Type|types]] or [[Go_Functions|functions]] that are meant to be publicly consumed. | Go [[Go_Language_Modularization#Overview|modularization]] is build upon the concept of package. [[Go_Packages#Overview|Packages]] provide a [[Go_Packages#Packages_as_Namespaces|namespace]] for their names, and also the mechanisms to [[Go_Packages#Packages_as_Encapsulation_Mechanism|encapsulate]] code, hide implementation details and only expose features, such as [[Go_Language#Variables|variables]], [[Go_Language#Type|types]] or [[Go_Functions|functions]] that are meant to be publicly consumed. | ||
=Packages as Namespaces= | =Packages as Namespaces= |
Revision as of 00:00, 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.