import导入包,有三种使用方法。
一、可以直接导入,如:
import (
"fmt"
)
使用:
fmt.Println("Hello world.")
二、
前面加“.”号,可以使用的时候可以省略fmt.,直接使用fmt包中的函数
import (
. "fmt"
)
使用:
Println("Hello world.")
三、指定别名
import (
f "fmt"
)
使用
f.Println("Hello world.")
Author:leedaning
本文地址:https://blog.csdn.net/leedaning/article/details/109318297