The sync.Map in Go 1.9 is yet another example of the price to pay for lacking generics.
The sync.Map in Go 1.9 is yet another example of the price to pay for lacking generics.
I was doing that with Turbo Pascal 6.0 and Borland C++ 2.x for MS-DOS with Turbo Vision and TObject as interface{} in 1993.
If you are sharing a map in this way across many goroutines you are probably "doing it wrong" in go anyways.
You can still write your own specialized error-prone repetitive containers for each and every type by hand.
Yet, once a language has generics, people don't use the old way even though it's still possible to.
Perhaps that's because it has no place when there's a replacement which is less error-prone, less repetitive, more usable, and can be implemented once in a library and used forever.
Outside of that, agreed.
Two lines? I think you underestimate what's going on in sync.Map: https://github.com/golang/go/blob/master/src/sync/map.go