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

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"
)
主站蜘蛛池模板: 临湘市| 长垣县| 讷河市| 宁河县| 博乐市| 平顶山市| 繁峙县| 成都市| 公安县| 措勤县| 白城市| 友谊县| 马关县| 什邡市| 商水县| 太和县| 武川县| 鸡西市| 青龙| 绥中县| 满洲里市| 霞浦县| 洛南县| 满城县| 泰安市| 开鲁县| 旌德县| 桃园县| 卫辉市| 双江| 太谷县| 滦平县| 宣威市| 玛纳斯县| 南郑县| 罗定市| 巨野县| 岳阳县| 彰化县| 共和县| 大同县|