You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-24 23:16:47 +02:00
fix build; add document for exported symbols
This commit is contained in:
@ -46,7 +46,7 @@ func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Marshaler = Marshaler{}
|
||||
var _ json.Unmarshaler = &Marshaler{}
|
||||
var _ json.Marshaler = marshalerForTest{}
|
||||
var _ json.Unmarshaler = &marshalerForTest{}
|
||||
|
||||
type typeForTest marshalerForTest
|
||||
|
@ -46,11 +46,11 @@ func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Marshaler = Marshaler{}
|
||||
var _ json.Unmarshaler = &Marshaler{}
|
||||
var _ json.Marshaler = marshalerForTest{}
|
||||
var _ json.Unmarshaler = &marshalerForTest{}
|
||||
|
||||
type typeForTest struct {
|
||||
S string
|
||||
M Marshaler
|
||||
M marshalerForTest
|
||||
I int8
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type marshalerForTest string
|
||||
// MarshalerForTest TEST ONLY
|
||||
type MarshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,20 +36,20 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
func (m MarshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
*m = marshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")))
|
||||
func (m *MarshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
*m = MarshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Marshaler = *new(marshalerForTest)
|
||||
var _ json.Unmarshaler = new(marshalerForTest)
|
||||
var _ json.Marshaler = *new(MarshalerForTest)
|
||||
var _ json.Unmarshaler = new(MarshalerForTest)
|
||||
|
||||
type typeForTest struct {
|
||||
F1 float64
|
||||
Marshaler
|
||||
MarshalerForTest
|
||||
F2 int32
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type marshalerForTest string
|
||||
// MarshalerForTest TEST ONLY
|
||||
type MarshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,20 +36,20 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
func (m MarshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(string(m))), nil
|
||||
}
|
||||
|
||||
func (m *marshalerForTest) UnmarshalText(text []byte) error {
|
||||
*m = marshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__")))
|
||||
func (m *MarshalerForTest) UnmarshalText(text []byte) error {
|
||||
*m = MarshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__")))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ encoding.TextMarshaler = *new(marshalerForTest)
|
||||
var _ encoding.TextUnmarshaler = new(marshalerForTest)
|
||||
var _ encoding.TextMarshaler = *new(MarshalerForTest)
|
||||
var _ encoding.TextUnmarshaler = new(MarshalerForTest)
|
||||
|
||||
type typeForTest struct {
|
||||
F1 float64
|
||||
Marshaler
|
||||
MarshalerForTest
|
||||
F2 int32
|
||||
}
|
||||
|
Reference in New Issue
Block a user