mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-17 04:30:03 +02:00
18 lines
310 B
Go
18 lines
310 B
Go
package message
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func Encode(v interface{}) ([]byte, bool) {
|
|
payload, err := json.Marshal(v)
|
|
if err != nil {
|
|
log.WithError(err).
|
|
WithField("v", v).
|
|
Warn("Failed to encode message to json")
|
|
return nil, false
|
|
}
|
|
return payload, true
|
|
}
|