Currently, unsafeBytesToString function violates the 6th rule of unsafe
pointer usage. That is, reflect.SliceHeader/String header should never
be used as plain struct. This misuse can make to silent memory
corruption, which can be difficult to track down when problem occurred.
Instead, use the more (right) idiom to convert slice of byte to string
without heap allocation.
goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
BenchmarkInvalid-8 1000000000 0.497 ns/op 0 B/op 0 allocs/op
BenchmarkValid-8 1000000000 0.239 ns/op 0 B/op 0 allocs/op
PASS
ok command-line-arguments 0.815s
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.