Skip to content

Instantly share code, notes, and snippets.

@abserari
Created March 9, 2022 03:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abserari/33afc0d2fd3f50e4576b8d128fc594ab to your computer and use it in GitHub Desktop.
Save abserari/33afc0d2fd3f50e4576b8d128fc594ab to your computer and use it in GitHub Desktop.
golang map equal
func equal(x, y map[string]int) bool {
if len(x) != len(y) {
return false
}
for k, xv := range x {
if yv, ok := y[k]; !ok || yv != xv {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment