1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-22 10:03:41 +02:00

ship_processor.go: move encodeMessage to transport/message/encoding.go

This commit is contained in:
Henrik Hautakoski 2023-01-17 21:03:48 +01:00
parent f589f5c0ed
commit 5c5d7e57a9
2 changed files with 21 additions and 14 deletions

View file

@ -0,0 +1,18 @@
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
}