Skip to content

Instantly share code, notes, and snippets.

@liamsi
Last active January 15, 2019 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamsi/01729f51259f912b0dd64e686025eaee to your computer and use it in GitHub Desktop.
Save liamsi/01729f51259f912b0dd64e686025eaee to your computer and use it in GitHub Desktop.
Custom marshaller
package main
import (
"fmt"
"github.com/tendermint/go-amino"
)
type HelloType struct {
}
func (h HelloType) MarshalAmino() ([]byte, error) {
return []byte("Hello World"), nil
}
func main() {
cdc := amino.NewCodec()
bz, _ := cdc.MarshalBinaryBare(HelloType{})
fmt.Println(string(bz))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment