고 언어 (Go Lang)
Go 패키지와 import (Go package, import)
종우공간
2021. 12. 15. 14:19
Types of packages:
executable:
generates a file that we can run
e.g. package main ("main: is special. must have a func called "main")
reusable:
code used as "helpers"
a good place to put reusable logic
e.g. package <<calculator>>(defines a package that can be used as a dependency; helper code)
import statement:
it is used to gain access to another package inside of the one that we are authoring
it can be either from standard library or other packages from someone else's
e.g. import "fmt"