↓ 跳过正文
  1. 标签/

Go

2023

golang msgpack

·1 分钟
这个库github.com/shamaton/msgpack/v2速度真是快,可是不如github.com/vmihailenco/msgpack/v5兼容性好(它支持omitempty标记)

2021

编译Win程序运行报错:go-sqlite3 requires cgo to work

·1 分钟
编译号程序放Windows运行报错 Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub, 按照下面参数编译就正常了 env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ GOOS=windows GOARCH=amd64 go build 安装 看看? apt-get install gcc-multilib apt-get install gcc-mingw-w64

2020

Golang HTTP 请求同时支持 gzip deflate Brotli 编码

·1 分钟
可利用 https://github.com/andybalholm/brotli 加个简单判断就支持br压缩 😀。 go 语言 http 默认未传递Accept-Encoding参数会自动支持gzip压缩, 😱 一旦修改此标记所有解码都需要自己来处理,我选用https://github.com/klauspost/compress解压。

使用Golang生成二维码图片

·1 分钟
看到几个 Go QRCode 库都不错,直接拿来测试看看了,谢谢你们 💐! http://github.com/boombuler/barcode/qr 最后选它输出图片再简单调整下尺寸 🎉 http://github.com/skip2/go-qrcode 小图时识别效果不太好 http://github.com/yeqown/go-qrcode 像只能输出 jpeg 格式