Timestamp type assertion fails on darwin
- Dominant language
- Go
- Stars
- 202
- Forks
- 61
- Avg merge
- 7d 20h
- Merged PRs (30d)
- 2
Description
I ran my test suite for my plugin on macOS. The one thing that it had a problem with was type asserting the timestamp. I used this code from the gstdout example:
```
flbTime := ts.(output.FLBTime)
```
This caused the plugin to panic:
```
panic: interface conversion: interface {} is uint64, not output.FLBTime
goroutine 17 [running, locked to thread]:
main.FLBPluginFlush(0x7fb67180f000, 0xc40000001d, 0x7fb670602270, 0xc42005ced8)
/Users/pivotal/workspace/foo/src/github.com/oratos/out_syslog/cmd/main.go:51 +0x25d
main._cgoexpwrap_44e740a65504_FLBPluginFlush(0x7fb67180f000, 0x1d, 0x7fb670602270, 0x0)
_cgo_gotypes.go:82 +0x3d
```
Easy workaround was to just do:
```
var timestamp time.Time
flbTime, ok := ts.(output.FLBTime)
if ok {
timestamp = flbTime.Time
} else {
timestamp = time.Now()
}
```
If I can get a useful timestamp out of the `uint64` I would prefer that.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.