Table of Contents
Package & import
What is it?
What is it used for?
Example
Important notes
Hard words (English)
Package & import
What is it?
`package` is how Go organizes code into reusable units.
`import` lets you use code from other packages.
What is it used for?
Organize code by folders/modules.
Reuse logic across your project.
Example
package
main
import
"fmt"
func
main
()
{
fmt
.
Println
(
"Hello"
)
}
Important notes
`package main` + `func main()` is the program entry point.
Names starting with an uppercase letter (e.g. `Println`) are exported (public).
Hard words (English)
organize
/ˈɔːrɡənaɪz/: tổ chức
reuse
/ˌriːˈjuːz/: tái sử dụng
entry point
/ˈentri pɔɪnt/: điểm bắt đầu chạy
exported
/ɪkˈspɔːrtɪd/: public (truy cập từ package khác)