摘要:
环境 Time 2022-08-25 Go 1.19 前言 说明 参考:https://gobyexample.com/string-functions 目标 使用 Go 语言的字符串函数。 示例 package main import ( "fmt" s "strings" ) var p = f 阅读全文
摘要:
环境 Time 2022-08-25 Go 1.19 前言 说明 参考:https://gobyexample.com/sorting-by-functions 目标 使用 Go 语言的自定义排序。 示例 package main import ( "fmt" "sort" ) type byLen 阅读全文
摘要:
环境 Time 2022-08-24 Go 1.19 前言 说明 参考:https://gobyexample.com/stateful-goroutines 目标 使用 Go 语言的有状态协程。 操作类型 type readOp struct { key int resp chan int } t 阅读全文
摘要:
环境 Time 2022-08-24 Go 1.19 前言 说明 参考:https://gobyexample.com/mutexes 目标 使用 Go 语言的互斥锁。 示例 package main import ( "fmt" "sync" ) type Container struct { m 阅读全文
摘要:
环境 Time 2022-08-24 Go 1.19 前言 说明 参考:https://gobyexample.com/atomic-counters 目标 使用 Go 语言的原子计数器。 示例 package main import ( "fmt" "sync" "sync/atomic" ) f 阅读全文