https://learnku.com/docs/go-f...python
break default func interface select case defer go map struct chan else goto package switch const fallthrough if range type continue for import return var
// :单行注释
/ /:多行注释golang
//当前程序的包名 package main //导入其余的包 import "fmt" //常量的定义 const PI = 3.14 //全局变量的声明与赋值 var name = "gopher" //通常类型的声明 type newType int //结构的声明 type gopher struct{} //接口的声明 type golang interface{} //由main 函数做为程序入口点启动 func main(){ Println("hello") }
import "fimt" import "os" simple import ( "fmt" "os" )
import ( io "fmt" ) 调用时候 io.Println("")
能够省略调用,易混淆不知道在哪一个包less
import ( . "fmt" ) 调用时候 Println("")
package main //import "fmt" import . "fmt" func main() { Println("hello") }
Go语言中,使用 ==大小写== 来决定该 常量、变量、类型、接口、结构或函数 是否能够被外部包所调用:函数
根据约定:code