tinylib / msgp

A Go code generator for MessagePack / msgpack.org[Go]
MIT License
1.81k stars 192 forks source link

time.Duration type does not work #349

Closed RiaanLaubscher closed 4 months ago

RiaanLaubscher commented 5 months ago

We are using slog and specifically https://github.com/samber/slog-fluentd and https://github.com/samber/slog-echo for logging HTTP traces.

The latency attribute that the handler logs is of type time.Duration which works fine if we are logging to stdout but once the fluentd handler is called it fails with a ErrUnsupportedType error for this attribute. I have traced the error to this msgp package since fluentd uses it for serialization.

I think there might be a case statement missing in msgp/write_bytes.go in AppendInt() for the time.Duration type which I support for was "added" in https://github.com/tinylib/msgp/pull/311.

klauspost commented 5 months ago

Could you send a PR with your proposed change and preferably a regression test?

RiaanLaubscher commented 4 months ago

@klauspost Please see https://github.com/tinylib/msgp/pull/353

klauspost commented 4 months ago

Closed via #353