Go Keyword import: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 28: | Line 28: | ||
=How Packages are Resolved= | =How Packages are Resolved= | ||
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;"> | |||
:[[Go Concepts - Runtime#GOPATH|GOPATH]] | |||
</blockquote> |
Revision as of 06:16, 22 March 2016
External
Internal
Overview
An import declaration states that the current package depends on the functionality of the imported package and wants access to its name space. Thus, the current package gains access to the exported identifiers exposed by the imported package.
... import [package-name-alias] "package-path-string-literal" ...
Example
... import "lib/math" ...
The package-name-alias is optional. If not specified, the package will be referred as the last segment of the path.