mirror of
https://github.com/json-iterator/go.git
synced 2025-03-29 21:20:52 +02:00
fix golint: do not export test types
This commit is contained in:
parent
891d33b415
commit
4351a2e6e9
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler string
|
||||
type marshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,16 +35,16 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
*m = Marshaler(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(Marshaler)
|
||||
var _ json.Unmarshaler = new(Marshaler)
|
||||
var _ json.Marshaler = *new(marshalerForTest)
|
||||
var _ json.Unmarshaler = new(marshalerForTest)
|
||||
|
||||
type typeForTest Marshaler
|
||||
type typeForTest marshalerForTest
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
@ -49,4 +49,4 @@ func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
var _ json.Marshaler = Marshaler{}
|
||||
var _ json.Unmarshaler = &Marshaler{}
|
||||
|
||||
type typeForTest Marshaler
|
||||
type typeForTest marshalerForTest
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler string
|
||||
type marshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,17 +35,17 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalJSON() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalJSON(text []byte) error {
|
||||
*m = Marshaler(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(Marshaler)
|
||||
var _ json.Unmarshaler = new(Marshaler)
|
||||
var _ json.Marshaler = *new(marshalerForTest)
|
||||
var _ json.Unmarshaler = new(marshalerForTest)
|
||||
|
||||
type typeForTest struct {
|
||||
F1 float64
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler string
|
||||
type marshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,17 +35,17 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(string(m))), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
*m = Marshaler(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(Marshaler)
|
||||
var _ encoding.TextUnmarshaler = new(Marshaler)
|
||||
var _ encoding.TextMarshaler = *new(marshalerForTest)
|
||||
var _ encoding.TextUnmarshaler = new(marshalerForTest)
|
||||
|
||||
type typeForTest struct {
|
||||
F1 float64
|
||||
|
@ -1,20 +1,20 @@
|
||||
package test
|
||||
|
||||
type DoubleEmbedded struct {
|
||||
type doubleEmbedded struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type Embedded1 struct {
|
||||
DoubleEmbedded
|
||||
type embedded1 struct {
|
||||
doubleEmbedded
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
DoubleEmbedded
|
||||
doubleEmbedded
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package test
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package test
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
package test
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
DoubleEmbedded1
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
DoubleEmbedded2
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
DoubleEmbedded1
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
DoubleEmbedded2
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
|
||||
F1 int32
|
||||
}
|
||||
|
||||
type Embedded1 struct {
|
||||
type embedded1 struct {
|
||||
DoubleEmbedded1
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
|
||||
F1 int32 `json:"F1"`
|
||||
}
|
||||
|
||||
type Embedded2 struct {
|
||||
type embedded2 struct {
|
||||
DoubleEmbedded2
|
||||
}
|
||||
|
||||
type typeForTest struct {
|
||||
Embedded1
|
||||
Embedded2
|
||||
embedded1
|
||||
embedded2
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
package test
|
||||
|
||||
type typeForTest struct {
|
||||
F JM `json:"f,omitempty"`
|
||||
F jm `json:"f,omitempty"`
|
||||
}
|
||||
|
||||
type JM string
|
||||
type jm string
|
||||
|
||||
func (t *JM) UnmarshalJSON(b []byte) error {
|
||||
func (t *jm) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t JM) MarshalJSON() ([]byte, error) {
|
||||
func (t jm) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`""`), nil
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler string
|
||||
type marshalerForTest string
|
||||
|
||||
func encode(str string) string {
|
||||
buf := bytes.Buffer{}
|
||||
@ -35,16 +35,16 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(string(m))), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
*m = Marshaler(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(Marshaler)
|
||||
var _ encoding.TextUnmarshaler = new(Marshaler)
|
||||
var _ encoding.TextMarshaler = *new(marshalerForTest)
|
||||
var _ encoding.TextUnmarshaler = new(marshalerForTest)
|
||||
|
||||
type typeForTest Marshaler
|
||||
type typeForTest marshalerForTest
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,16 +37,16 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(m.X)), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalText(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ encoding.TextMarshaler = Marshaler{}
|
||||
var _ encoding.TextUnmarshaler = &Marshaler{}
|
||||
var _ encoding.TextMarshaler = marshalerForTest{}
|
||||
var _ encoding.TextUnmarshaler = &marshalerForTest{}
|
||||
|
||||
type typeForTest Marshaler
|
||||
type typeForTest marshalerForTest
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,18 +37,18 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(m.X)), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalText(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ encoding.TextMarshaler = Marshaler{}
|
||||
var _ encoding.TextUnmarshaler = &Marshaler{}
|
||||
var _ encoding.TextMarshaler = marshalerForTest{}
|
||||
var _ encoding.TextUnmarshaler = &marshalerForTest{}
|
||||
|
||||
type A Marshaler
|
||||
type A marshalerForTest
|
||||
|
||||
type typeForTest A
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,20 +37,20 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(m.X)), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalText(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ encoding.TextMarshaler = Marshaler{}
|
||||
var _ encoding.TextUnmarshaler = &Marshaler{}
|
||||
var _ encoding.TextMarshaler = marshalerForTest{}
|
||||
var _ encoding.TextUnmarshaler = &marshalerForTest{}
|
||||
|
||||
type typeForTest struct {
|
||||
S string
|
||||
M Marshaler
|
||||
M marshalerForTest
|
||||
I int8
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Marshaler struct {
|
||||
type marshalerForTest struct {
|
||||
X string
|
||||
}
|
||||
|
||||
@ -37,19 +37,19 @@ func decode(str string) string {
|
||||
return string(bs)
|
||||
}
|
||||
|
||||
func (m Marshaler) MarshalText() ([]byte, error) {
|
||||
func (m marshalerForTest) MarshalText() ([]byte, error) {
|
||||
return []byte(`MANUAL__` + encode(m.X)), nil
|
||||
}
|
||||
|
||||
func (m *Marshaler) UnmarshalText(text []byte) error {
|
||||
func (m *marshalerForTest) UnmarshalText(text []byte) error {
|
||||
m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ encoding.TextMarshaler = Marshaler{}
|
||||
var _ encoding.TextUnmarshaler = &Marshaler{}
|
||||
var _ encoding.TextMarshaler = marshalerForTest{}
|
||||
var _ encoding.TextUnmarshaler = &marshalerForTest{}
|
||||
|
||||
type A Marshaler
|
||||
type A marshalerForTest
|
||||
|
||||
type typeForTest struct {
|
||||
S string
|
||||
|
Loading…
x
Reference in New Issue
Block a user