This commit is contained in:
Tnze
2021-12-14 12:39:17 +08:00
parent 4e7db1e122
commit f2c0c9e4a8

View File

@ -13,7 +13,7 @@ import (
// Marshal is the shortcut of NewEncoder().Encode() with empty tag name.
// Notices that repeatedly init buffers is low efficiency.
// Using Encoder and Reset the buffer in each times is recommended in that cases.
// Using Encoder and Reset the buffer in each time is recommended in that cases.
func Marshal(v interface{}) ([]byte, error) {
var buf bytes.Buffer
err := NewEncoder(&buf).Encode(v, "")
@ -31,7 +31,7 @@ func NewEncoder(w io.Writer) *Encoder {
// Encode encodes v into the writer inside Encoder with the root tag named tagName.
// In most cases, the root tag typed TagCompound and the tag name is empty string,
// but any other type is allowed just because there is valid technically. Once if
// you should pass an string into this, you should get a TagString.
// you should pass a string into this, you should get a TagString.
//
// Normally, any slice or array typed Go value will be encoded as TagList,
// expect `[]int8`, `[]int32`, `[]int64`, `[]uint8`, `[]uint32` and `[]uint64`,