golang init 与 sync.Once 区别 sync.Once 是在代码运行中需要的时候执行,且只执行一次。init 函数是在文件包首次被加载的时候执行,且只执行一次。一个包中可以有多个 init 函数。init 函数不能被其它函数调用。const、var、 init 函数与 main 函数的执行顺序:验证代码package mainimport ( "fmt" "sync" Golang 2020/06/20
挂载多分区镜像文件 日前从闲鱼购得一块 RK3399 的广告机主板,板子接口较为丰富,同比相同配置的开发板其价格较为低廉。当然了,它价格低自然是有原因的。。。则板子的是没有电路图等资料的,目前只能盲测试了,相关折腾进展及讨论在此 https://www.right.com.cn/forum/thread-4033942-1-1.html 整理的资料 https://github.com/lanseyujie/tn3399_v3折腾这种板子自然少不了与各种镜像文件打交道,但是镜像的修改需 Linux 2020/06/10
golang 实现的快速排序 package mainimport ( "fmt" "math/rand" "sort" "time")// func partition(arr Golang 2020/05/23
ffmpeg 转换 m3u8 直播流为 mp4 文件 ffmpeg -headers 'Cookie: xxx' \ # m3u8 请求 key 接口使用的 cookie -user_agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML,&nb Linux 2020/04/09
golang 解析腾讯视频真实链接 本文最后更新于 2020/05/01 18:22:37 。package mainimport ( "fmt" "io/ioutil" "net/http" "regexp" "string Golang 2020/04/07
gpg 密钥生成与延期 # 生成 gpg 密钥gpg --gen-key# 生成吊销证书gpg --gen-revoke 695C8981B2442634# 列出所有 gpg 公钥gpg --list-keys# 列出所有 gpg 私钥gpg --list-secret-keys# 删除 gpg  Linux 2020/02/12
golang rpc demo 本文最后更新于 2020/07/11 10:27:26 。客户端调用服务端server.gopackage mainimport ( "log" "net" "net/http" "net/rpc" Golang 2020/01/14
golang 反射的使用 package mainimport ( "fmt" "go/ast" "reflect")type Member struct { Id &nbs Golang 2020/01/04
注意 io.MultiWriter 的返回值 本文最后更新于 2020/07/04 01:58:54 。io.MultiWriter() 可以将多个实现 io.Writer 接口实例包装为一个,实现多实例统一写入。但在开发自定义日志库时使用此函数遇到了这样一个问提,传入的多个接口实例总会有几个不会生效,而且好似是否生效还跟入传参位置有关。 Golang 2019/12/25
golang 模板语法 测试用的变量和方法type struct Blog { Title string}map[string]interface{}type FuncMap map[string]interface{}func add(x, y int) int变量{{/* . 代表传入模板的 struct&nb Golang 2019/12/08