mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-18 04:40:03 +02:00
transport/message/encoder.go: remove Encode() function.
This commit is contained in:
parent
55f013a386
commit
a20295ee88
1 changed files with 0 additions and 17 deletions
|
|
@ -1,21 +1,4 @@
|
|||
package message
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Encoder is a function that can encode a object to the encoded format.
|
||||
type Encoder func(v any) ([]byte, error)
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue