官术网_书友最值得收藏!

  • Security with Go
  • John Daniel Leon
  • 112字
  • 2021-06-30 19:06:49

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"
)
主站蜘蛛池模板: 乐陵市| 灵台县| 洪泽县| 绥棱县| 哈尔滨市| 牙克石市| 祁连县| 泌阳县| 邵武市| 阿克苏市| 房产| 鸡西市| 清河县| 开鲁县| 莱西市| 东港市| 新营市| 乌海市| 德阳市| 七台河市| 平远县| 泉州市| 连城县| 涟源市| 龙泉市| 固原市| 临泽县| 丰顺县| 南华县| 大同县| 舟山市| 成武县| 溧水县| 荥阳市| 满洲里市| 安平县| 饶河县| 翁牛特旗| 大石桥市| 繁峙县| 邮箱|