上一页 1 ··· 6 7 8 9 10 11 下一页
  2022年5月17日
摘要: 结构体 //go 结构体使用type struct 来定义 type Student struct { name string age int gender string score float64 } func main() { lilei := Student{ name: "lilei", a 阅读全文
posted @ 2022-05-17 11:15 每天进步一点点点点点 阅读(17) 评论(0) 推荐(0)
摘要: const iota //在go中没有枚举类型,但是可以使用const iota进行模拟 const ( MON = iota TUE WEN ) //iota 是常量计数器 //iota从0开始,每换行递增1 const ( ADDR = "shenzhen" ) //const 自动推导 fmt 阅读全文
posted @ 2022-05-17 11:13 每天进步一点点点点点 阅读(61) 评论(0) 推荐(0)
摘要: switch arr1 := []string{"hello","world2"} switch arr1[1] { case "hello": fmt.Println("hello") case "world": fmt.Println("world") default: fmt.Println( 阅读全文
posted @ 2022-05-17 11:12 每天进步一点点点点点 阅读(38) 评论(0) 推荐(0)
摘要: 函数 func test2(a int,b int,c int) (int,string) { //函数返回值在参数列表之后 //如果有多个返回值,使用圆括号 return a+b+c,"hello" } func test3(a int) (s1 string) { //函数返回值可以指定名字,在 阅读全文
posted @ 2022-05-17 11:08 每天进步一点点点点点 阅读(24) 评论(0) 推荐(0)
摘要: 字典 //1定义map,然后在分配空间 var dict2 map[string]string dict2 = make(map[string]string) dict2["key"] = "value" //2定义map并分配空间,常用 dict := make(map[int]string,20 阅读全文
posted @ 2022-05-17 11:04 每天进步一点点点点点 阅读(39) 评论(0) 推荐(0)
摘要: 数组 //1、var定义 var arr1 [10]int arr1[0] = 1 //自动推导 arr2 := [10]int{} arr2[0] = 2 fmt.Println(arr1,arr2) for k,v := range arr1{ fmt.Println(k,v) } 切片 不定长 阅读全文
posted @ 2022-05-17 10:57 每天进步一点点点点点 阅读(30) 评论(0) 推荐(0)
摘要: go 基础指针 //go 语音指针 name := "lili" ptr := &name fmt.Println(*ptr) fmt.Println(ptr) //2 new关键字定义 name2prt := new(string) *name2prt = "lily" fmt.Println(n 阅读全文
posted @ 2022-05-17 10:47 每天进步一点点点点点 阅读(22) 评论(0) 推荐(0)
摘要: go 基础变量 //1 定义变了 var 变量名 数据类型 var name string name = "alince" fmt.Println("name: ", name) var age int age = 33 fmt.Println("age: ", age) //2 定义时直接赋值 v 阅读全文
posted @ 2022-05-17 10:44 每天进步一点点点点点 阅读(21) 评论(0) 推荐(0)
摘要: 1、不用重启生效/etc/fstab Mount -a 2、for循环使用 for((i=1;i<15;i++)) do mkdir /data$i;done 3、查找systemctl服务,然后通过systemctl启动 systemctl list-unit-files --type=servi 阅读全文
posted @ 2022-05-17 10:38 每天进步一点点点点点 阅读(52) 评论(0) 推荐(0)
  2022年5月16日
摘要: 1、调整时区 ls -l /etc/localtime #查看当前时区 rm /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 2、启动ntp systemctl status ntp systemctl li 阅读全文
posted @ 2022-05-16 12:23 每天进步一点点点点点 阅读(4478) 评论(0) 推荐(1)
上一页 1 ··· 6 7 8 9 10 11 下一页