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
Current implementation of msgp:sort directive used for canonical encoding and decoding by sorting map fields associate the types string names with it's SortType and LessFunction. This is done as commented in elem.go since map keys don't have references to the Elem associated with the directive.
Additionally msgp parses all import packages for the package it's generating methods which means that a msgp:sort directive exists for a given type already in the imported package it will be written first and then later overwritten by the main package being parsed which is always parsed last.
This can lead to interesting sorts of bugs where a msgp:sort can be missing in the parsed package but still be populated with potentially unexpected values from one of the imports.
We should guard against this either by not using sort directives from the import packages or by finding a way to make the process more robust and stop attaching the directives to strings representing type names.
The text was updated successfully, but these errors were encountered:
Current implementation of
msgp:sort
directive used for canonical encoding and decoding by sorting map fields associate the types string names with it's SortType and LessFunction. This is done as commented inelem.go
since map keys don't have references to the Elem associated with the directive.Additionally msgp parses all import packages for the package it's generating methods which means that a
msgp:sort
directive exists for a given type already in the imported package it will be written first and then later overwritten by the main package being parsed which is always parsed last.This can lead to interesting sorts of bugs where a
msgp:sort
can be missing in the parsed package but still be populated with potentially unexpected values from one of the imports.We should guard against this either by not using sort directives from the import packages or by finding a way to make the process more robust and stop attaching the directives to strings representing type names.
The text was updated successfully, but these errors were encountered: