Created
March 9, 2022 03:21
-
-
Save abserari/33afc0d2fd3f50e4576b8d128fc594ab to your computer and use it in GitHub Desktop.
golang map equal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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