Standard library / sync
sync.Map
Concurrent map optimized for particular access patterns, such as write-once/read-many or disjoint keys. Prefer a typed map with a lock for general invariants. Do not copy after use. Expected stdout: '1\n'.
Formal Syntax & Structure
go syntaxgo
type Map struct {}Working Example
Example Snippetgo
package main
import ( "fmt" "sync")
func main() { var m sync.Map; m.Store("a", 1); v, _ := m.Load("a"); fmt.Println(v) }