diff --git a/src/sync/map_go123.go b/src/sync/map_go123.go new file mode 100644 index 00000000..b7bd61e1 --- /dev/null +++ b/src/sync/map_go123.go @@ -0,0 +1,13 @@ +//go:build go1.23 + +package sync + +// Go 1.23 added the Clear() method. The clear() function is added in Go 1.21, +// so this method can be moved to map.go once we drop support for Go 1.20 and +// below. + +func (m *Map) Clear() { + m.lock.Lock() + defer m.lock.Unlock() + clear(m.m) +}