Go
Go 语言。
gaoZhuanMing
这个作者很懒,什么都没留下…
展开
-
Go 同步机制
1. 互斥量 import "sync" var mutex sync.Mutex mutex.Lock() // ... mutex.Unlock() 2. 读写锁 import "sync" var mutex sync.RWMutex 读者: mutex.RLock() // ... mutex.RUnlock() 写者: mutex.Lock() // ... mutex.Unlock() 3. 条件变量 import "sync" var mutex sync.Mutex var原创 2021-12-01 20:21:18 · 284 阅读 · 0 评论 -
Go Web—gin框架
1. Hello, World! package main import ( "github.com/gin-gonic/gin" "net/http" ) type HelloController struct {} func (controller *HelloController) Hello (ctx *gin.Context) { ctx.String(http.StatusOK, "Hello, World!") } func main() { controller := &am原创 2021-11-13 23:24:19 · 307 阅读 · 0 评论 -
Go 类型系统
1. 类型别名 type Alias = Type 此后,在 Alias 的作用域内,Alias 就是 Type 的别名。如, type Second = uint32 var t1 Second = 10 var t2 uint32 = 20 var t3 = t1 + t2 2. 类型定义 type NewType Type NewType 是一个新的类型,称为 defined type,它不同于任何类型,包括 Type。如, type Second uint32 var t1 Second =原创 2021-11-11 15:58:05 · 304 阅读 · 0 评论