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

  • 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"
)
主站蜘蛛池模板: 犍为县| 东港市| 巩留县| 瓮安县| 什邡市| 浦北县| 筠连县| 马龙县| 增城市| 西乌珠穆沁旗| 邓州市| 滕州市| 新沂市| 盘山县| 邻水| 余江县| 张北县| 德阳市| 屏东市| 凌云县| 积石山| 常宁市| 瓦房店市| 凤山市| 林周县| 夏津县| 东港市| 舟山市| 永德县| 泽州县| 伊川县| 巩留县| 徐汇区| 洪湖市| 开阳县| 石林| 牡丹江市| 曲松县| 藁城市| 天全县| 治多县|