golang/go

sync: add examples for Map

Open

#20,973 建立於 2017年7月10日

在 GitHub 查看
 (5 留言) (2 反應) (0 負責人)Go (19,008 fork)batch import
DocumentationNeedsFixcompiler/runtimehelp wanted

倉庫指標

Star
 (133,883 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

It would be nice if there were usage examples for sync.Map, but there are not currently any.

  • Can keys be ordinary values like strings, or should they be custom types, a la context.WithValue?
  • Should I always store a pointer to a value, or can I store a value like a string? If the former how should I do it?

貢獻者指南