有梦就去追 有梦就去追

记录精彩的程序人生

目录
Go代码的基本结构
/    

Go代码的基本结构

//当前程序的包名
package main

//导入其他的包
import (
	io "fmt"
)

//常量的定义
const PI = 3.14

//全局变量的声明与赋值
var name = "gohelper"

//一般类型声明
type newType int

//结构的声明
type gopher struct {
}

//接口的声明
type golang interface{}

//由main函数作为程序入口启动
func main() {
	//局部变量
	var a int = 65
	b := string(a)
	io.Println(b)
	var c string = "你好"
	io.Println("hello world!你好,世界!")
	io.Println(c)
}

标题:Go代码的基本结构
作者:flhuoshan
地址:http://ymjqz.com/articles/2021/01/03/1427945460776.html