tinylib / msgp

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

time.Duration type does not work #349

Closed RiaanLaubscher closed 4 days ago

RiaanLaubscher commented 2 weeks 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 2 weeks ago

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

RiaanLaubscher commented 4 days ago

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

klauspost commented 4 days ago

Closed via #353