Diffs are slightly off for assert.Equal on maps
It seems the map is rendered with no trailing , for the last element, so the diff catches that as a modified line.. but really the line isn't modified..
Diff:
--- Expected
+++ Actual
@@ -1,5 +1,7 @@
-(map[string]interface {}) (len=3) {
+(map[string]interface {}) (len=5) {
(string) (len=15) "installed.first": (string) (len=20) "2006-01-02T15:04:05Z",
(string) (len=14) "installed.last": (string) (len=20) "2006-01-02T15:04:05Z",
- (string) (len=23) "installed.windows.first": (string) (len=20) "2006-01-02T15:04:05Z"
+ (string) (len=23) "installed.windows.first": (string) (len=20) "2006-01-02T15:04:05Z",
+ (string) (len=22) "installed.windows.last": (string) (len=20) "2006-01-02T15:04:05Z",
+ (string) (len=30) "installed.windows.last_version": (string) (len=3) "8.1"
}
See how installed.windows.first is different only in the trailing , !
thanks @abourget
I'll have to check there's an option in spew to print the trailing comma.
Would you be interested in doing a pull request with the enhancement?
yes :) I'll take a look into it...
Opened a PR for this in go-spew.
I pinged the maintainer about the go-spew PR. If he agrees to merge it then we can close this, otherwise I'll probably go ahead and close it anyway unless someone has a clever idea that will resolve it without changing go-spew.
@georgelesica-wf Have you considered using Litter instead of Spew? We wrote Litter to replace Spew in our tests, as we use a lot of snapshot tests where we store results in files and compare them. Its output is more consistent and more readable, since it's basically just Go.
seems that when comparing maps, order matters? is that the issue here?