🗒️go学习—基础
2024-1-22
| 2024-1-23
字数 3791阅读时长 10 分钟
type
status
date
slug
summary
tags
category
icon
password
环境搭建找google
基础看一遍就过了,不深究,写脚本和工具的时候再看

第一个程序

导包,主函数运行,fmt标准输出
notion image

变量

notion image

常量

notion image
iota:特殊常量
notion image

运算符

notion image

条件语句

notion image

循环语句

  1. for循环
notion image
  1. goto循环
notion image

函数

notion image

变量作用域

形式参数会作为函数的局部变量来使用
notion image

数组

notion image

指针

notion image

结构体

notion image

切片

notion image
如果想增加切片的容量,我们必须创建一个新的更大的切片并把原分片的内容都拷贝过来。
append(),切片容量不足时自动扩容到(当前cap + 1)*2
notion image
copy()
notion image

语言范围range

notion image

map集合

notion image

递归函数

notion image

接口

错误处理

notion image

并发

简单实现

notion image

通道

通道(channel)是用来传递数据的一个数据结构。
通道可用于两个 goroutine 之间通过传递一个指定类型的值来同步运行和通讯。
由于是并发执行,最终x,y,z的值不确定
 

通道缓冲区和读取数据的顺序

遍历通道和通道关闭

输出:0 1 1 2 3 5 8 13 21 34

类型转换

接口类型转换
 
  • 脚本编程
  • go学习—端口扫描BUU weblogic合集
    Loading...