Last active
August 29, 2015 14:07
-
-
Save darthberen/c5a7701ee1d3a394d78f to your computer and use it in GitHub Desktop.
go map comparisons problem
This file contains 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
type Doc struct { | |
Map map[string]string `json:"map"` | |
} | |
func main() { | |
// source is a JSON document from an external service | |
var doc Doc | |
json.Unmarshal(source, &doc) | |
SomeFunc(doc.Map) | |
} | |
func SomeFunc(paramMap map[string]string) { | |
compMap := map[string]string{} | |
if reflect.DeepEqual(paramMap, compMap) { | |
// why does this not execute when expected? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment