You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After switching to the go 1.3 beta mime.FormatMediaType has started giving inconsistent
results. This is obviously a result of the map parameter and up till now we've just been
lucky to pass small enough maps that haven't been randomized.
The function produces output from a long chain of processing and having the output
consistent simplifies testing considerably. We usually solve this problem by iterating
over a sorted list of the map keys rather than the map itself.
Proposed fix. Replace line 34 of src/pkg/mime/mediatype.go with the following.
attributes := make([]string, 0, len(param))
for a, _ := range param {
attributes = append(attributes, a)
}
sort.Strings(attributes)
for attribute, _ := range attributes {
value := param[attribute]
The text was updated successfully, but these errors were encountered:
Map iteration order issue. Go 1.2 and earlier had stable results
for small maps.
Fixesgolang#8115
LGTM=r, rsc
R=golang-codereviews, r
CC=dsymonds, golang-codereviews, iant, rsc
https://golang.org/cl/98580047
by anton.hendriks:
The text was updated successfully, but these errors were encountered: