随笔分类 -  golang

摘要:package main import ( "container/ring" "fmt" ) var size int = 10 func main() { myRing := ring.New(size) fmt.Println("Empty ring:", *myRing) for i := 0 阅读全文
posted @ 2023-08-05 16:30 salami_china 阅读(22) 评论(0) 推荐(0) 编辑
摘要:1、安装 gRPC 和 Protobuf protobuf 安装链接:https://liqiang.io/post/install-protobuf-in-centos-f0a9b926 protoc-gen-go 二进制构建 git clone https://github.com/golang 阅读全文
posted @ 2023-05-24 17:03 salami_china 阅读(39) 评论(0) 推荐(0) 编辑
摘要:源码链接:https://github.com/zupzup/boltdb-example.git package main import ( "bytes" "encoding/json" "fmt" "github.com/boltdb/bolt" "log" "time" ) // Confi 阅读全文
posted @ 2023-05-23 20:36 salami_china 阅读(13) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "time" "github.com/florianl/go-conntrack" ) func main() { // 创建 conntrack 客户端 client, err := conntrack.Dial(nil) if err != 阅读全文
posted @ 2023-04-21 21:02 salami_china 阅读(155) 评论(0) 推荐(0) 编辑
摘要:安装 graphviz yum install graphviz 开始采集: go tool pprof http://192.168.100.100:1000/debug/pprof/heap 输出 svg 文件,web可以查看 #go tool pprof http://192.168.100. 阅读全文
posted @ 2023-03-07 14:50 salami_china 阅读(34) 评论(0) 推荐(0) 编辑
摘要:报错信息: error obtaining VCS status: exit status 128 解决办法: go env -w GOFLAGS="-buildvcs=false" 阅读全文
posted @ 2023-02-21 15:59 salami_china 阅读(2109) 评论(0) 推荐(0) 编辑
摘要:参考链接:https://studygolang.com/articles/12972 func main() { wg := sync.WaitGroup{} wg.Add(100) for i := 0; i < 100; i++ { go func(i int) { fmt.Println(i 阅读全文
posted @ 2022-11-29 09:32 salami_china 阅读(38) 评论(0) 推荐(0) 编辑
摘要:package main import ( "fmt" "runtime" ) func main() { fmt.Println(runtime.GOOS) fmt.Println(runtime.GOARCH) } 结果: #go run go-cpu.go linux amd64 阅读全文
posted @ 2022-10-31 10:56 salami_china 阅读(779) 评论(0) 推荐(0) 编辑
摘要:参考链接: https://www.geek-share.com/detail/2712555235.html go语言中在用binary.Read(),把二进制映射为结构体时,如果出现panic: reflect: reflect.Value.SetUint using value obtaine 阅读全文
posted @ 2022-03-01 16:16 salami_china 阅读(184) 评论(0) 推荐(0) 编辑
摘要:问题:版本不支持 #tc filter add dev veth100 ingress bpf da obj proxy.o sec tc No ELF library support compiled in. 解决: # 安装libbpf: git clone https://github.com 阅读全文
posted @ 2022-02-19 22:54 salami_china 阅读(897) 评论(0) 推荐(0) 编辑
摘要:demo package main import "fmt" func main() { s := make([]string, 10) // 前10个元素没初始化,就是10个空字符串 fmt.Println(len(s)) s = append(s, "111111") // 第11位追加字符串 阅读全文
posted @ 2021-12-07 11:00 salami_china 阅读(118) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示