Syncmap
add length func base on go 1.9 sync.map .
Install / Use
/learn @rfyiamcool/SyncmapREADME
syncmap
Golang官方在 1.9 加入了sync.map协程安全的map, 性能和安全得以保证,就是没有Length方法. 自己丰衣足食加了个补丁.
至于官方为什么不加Length方法原因,有兴趣的可以看看issue. 简单说官方认为 map 本来就不应该有length的实现.

How
在sync.map结构体里加了计数器,在触发Store和Delete时,Atomic.AddInit64 +1 -1就可以了.
To Do List
- 加入 test 测试单元
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
