内容简介:eg:
import 机制
golang_import_机制.png
sugar
import(
"time" //普通写法
. "fmt" //使用此包内的成员时不带fmt前缀
j "encoding/json" //json包重命名
_ "net" //仅执行net包中的init方法,不能调用该包成员
)
使用规范
- 不要使用相对路径引入包(以GOPATH/src作为根目录)
- 引入包顺序遵循 标准库,项目包,第三方包
- 第三方包按命名顺序
eg:
import(
"fmt"
"time" //标准库
"controllers/doctor"
"controllers/student" //项目包
"models/person" //项目包
"github.com/garyburd/redigo/redis"
"github.com/go-sql-driver/mysql" //第三方包
)
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Writing Windows VxDs and Device Drivers, Second Edition
Karen Hazzah / CMP / 1996-01-12 / USD 54.95
Software developer and author Karen Hazzah expands her original treatise on device drivers in the second edition of "Writing Windows VxDs and Device Drivers." The book and companion disk include the a......一起来看看 《Writing Windows VxDs and Device Drivers, Second Edition》 这本书的介绍吧!