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

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"
)
主站蜘蛛池模板: 固始县| 桐城市| 曲周县| 子长县| 安新县| 仪陇县| 元阳县| 河北区| 西藏| 仪陇县| 五常市| 手机| 绍兴县| 霍山县| 天峻县| 平南县| 连平县| 大庆市| 巩义市| 吉水县| 滦南县| 十堰市| 咸丰县| 苍溪县| 华坪县| 扎兰屯市| 嘉祥县| 祁门县| 宜兴市| 柞水县| 开江县| 英超| 江西省| 大田县| 陵川县| 普宁市| 桃园县| 贵定县| 仙游县| 宜宾市| 昌宁县|