Security with Go
上QQ阅读APP看书,第一时间看更新

Packages

Packages are just directories. Every directory is its own package. Creating subdirectories creates a new package. Having no subpackages leads to a flat hierarchy. Subdirectories are used just for organizing code.

Packages should be stored in the src folder of your $GOPATH variable.

A package name should match the folder name or be named main. A main package means that it is not intended to be imported into another application, but meant to compile and run as a program. Packages are imported using the import keyword.

You can import packages individually:

import "fmt" 

Alternatively, you can import multiple packages at once by wrapping them with parenthesis:

import (
"fmt"
"log"
)