The encoding/json docs explain that you need to provide a MarshalText
method to encode integer types as map keys, otherwise they will be
formatted as a string version of the decimal number.
Providing MarshalText and UnmarshalText also uses those methods as a
fallback for MarshalJSON and UnmarshalJSON, so we no longer need
explicit versions of those latter methods.
Apparently Sources were using IDs as map keys and were providing the
,string attribute on the JSON tag on the struct. This was not correct so
that attribute has been removed. Existing sources will no longer be
readable as a result of this change.
Fixes#13277.
I did this with a dumb editor macro, so some comments changed too.
Also rename root package from platform to influxdb.
In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.
Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
While debugging, I was printing out some structs with %#v and found that
Go would format the structs' IDs as uint64s instead of with the String
method. That behavior needlessly made my debugging more difficult.
Before, %#v would format a type with an ID like:
{ID:0x2def021097c6000}
After:
{ID:"02def021097c6000"}
They look similar, but a search for the string ID would not match the
uint64 default formatting.