종우의 컴퓨터 공간

Go 패키지와 import (Go package, import) 본문

고 언어 (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"

 

'고 언어 (Go Lang)' 카테고리의 다른 글

Go 커스텀 타입 (Go Custom Type)  (0) 2021.12.18
Go 자료구조 (Go data structure)  (0) 2021.12.15
Go 커맨드라인 (GO CLI)  (0) 2021.12.15