1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-02 03:28:25 +08:00

commands: Replaced 'Formatter' with 'Marshaller'

This commit is contained in:
Matt Bell
2014-11-03 23:02:50 -08:00
committed by Juan Batiz-Benet
parent 068e10cc5d
commit 0149f65c6c
2 changed files with 5 additions and 10 deletions

View File

@ -40,10 +40,6 @@ const (
// TODO: support more encoding types
)
// Marshaller is a function used by coding types.
// TODO this should just be a `coding.Codec`
type Marshaller func(res Response) ([]byte, error)
var marshallers = map[EncodingType]Marshaller{
JSON: func(res Response) ([]byte, error) {
if res.Error() != nil {
@ -63,11 +59,11 @@ var marshallers = map[EncodingType]Marshaller{
return nil, ErrNoFormatter
}
s, err := format(res)
bytes, err := format(res)
if err != nil {
return nil, err
}
return []byte(s), nil
return bytes, nil
},
}