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

  • 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"
)
主站蜘蛛池模板: 馆陶县| 武鸣县| 永州市| 海城市| 庆元县| 周宁县| 岢岚县| 宁安市| 利津县| 延津县| 临邑县| 章丘市| 依安县| 集安市| 托克逊县| 绥江县| 井冈山市| 黎城县| 宣威市| 海伦市| 曲水县| 淳安县| 峨眉山市| 乌什县| 逊克县| 新津县| 依安县| 邹城市| 庆城县| 泰安市| 红原县| 黑河市| 光山县| 独山县| 固原市| 西盟| 科技| 阿拉善右旗| 厦门市| 武义县| 新兴县|