1
0
mirror of https://github.com/json-iterator/go.git synced 2025-04-26 11:42:56 +02:00

fix golint: do not export test types

This commit is contained in:
Tao Wen 2017-07-09 11:55:58 +08:00
parent 891d33b415
commit 4351a2e6e9
20 changed files with 98 additions and 98 deletions

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler string type marshalerForTest string
func encode(str string) string { func encode(str string) string {
buf := bytes.Buffer{} buf := bytes.Buffer{}
@ -35,16 +35,16 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil
} }
func (m *Marshaler) UnmarshalJSON(text []byte) error { func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
*m = Marshaler(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))) *m = marshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")))
return nil return nil
} }
var _ json.Marshaler = *new(Marshaler) var _ json.Marshaler = *new(marshalerForTest)
var _ json.Unmarshaler = new(Marshaler) var _ json.Unmarshaler = new(marshalerForTest)
type typeForTest Marshaler type typeForTest marshalerForTest

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,11 +37,11 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil 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__")) m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
return nil return nil
} }
@ -49,4 +49,4 @@ func (m *Marshaler) UnmarshalJSON(text []byte) error {
var _ json.Marshaler = Marshaler{} var _ json.Marshaler = Marshaler{}
var _ json.Unmarshaler = &Marshaler{} var _ json.Unmarshaler = &Marshaler{}
type typeForTest Marshaler type typeForTest marshalerForTest

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,11 +37,11 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil 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__")) m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
return nil return nil
} }

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,11 +37,11 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil 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__")) m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
return nil return nil
} }

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,11 +37,11 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(m.X) + `"`), nil 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__")) m.X = decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))
return nil return nil
} }

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler string type marshalerForTest string
func encode(str string) string { func encode(str string) string {
buf := bytes.Buffer{} buf := bytes.Buffer{}
@ -35,17 +35,17 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalJSON() ([]byte, error) { func (m marshalerForTest) MarshalJSON() ([]byte, error) {
return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil return []byte(`"MANUAL__` + encode(string(m)) + `"`), nil
} }
func (m *Marshaler) UnmarshalJSON(text []byte) error { func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
*m = Marshaler(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__"))) *m = marshalerForTest(decode(strings.TrimPrefix(strings.Trim(string(text), `"`), "MANUAL__")))
return nil return nil
} }
var _ json.Marshaler = *new(Marshaler) var _ json.Marshaler = *new(marshalerForTest)
var _ json.Unmarshaler = new(Marshaler) var _ json.Unmarshaler = new(marshalerForTest)
type typeForTest struct { type typeForTest struct {
F1 float64 F1 float64

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler string type marshalerForTest string
func encode(str string) string { func encode(str string) string {
buf := bytes.Buffer{} buf := bytes.Buffer{}
@ -35,17 +35,17 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(string(m))), nil return []byte(`MANUAL__` + encode(string(m))), nil
} }
func (m *Marshaler) UnmarshalText(text []byte) error { func (m *marshalerForTest) UnmarshalText(text []byte) error {
*m = Marshaler(decode(strings.TrimPrefix(string(text), "MANUAL__"))) *m = marshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__")))
return nil return nil
} }
var _ encoding.TextMarshaler = *new(Marshaler) var _ encoding.TextMarshaler = *new(marshalerForTest)
var _ encoding.TextUnmarshaler = new(Marshaler) var _ encoding.TextUnmarshaler = new(marshalerForTest)
type typeForTest struct { type typeForTest struct {
F1 float64 F1 float64

View File

@ -1,20 +1,20 @@
package test package test
type DoubleEmbedded struct { type doubleEmbedded struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type Embedded1 struct { type embedded1 struct {
DoubleEmbedded doubleEmbedded
F1 int32 F1 int32
} }
type Embedded2 struct { type embedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
DoubleEmbedded doubleEmbedded
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -1,14 +1,14 @@
package test package test
type Embedded1 struct { type embedded1 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type Embedded2 struct { type embedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -1,14 +1,14 @@
package test package test
type Embedded1 struct { type embedded1 struct {
F1 int32 F1 int32
} }
type Embedded2 struct { type embedded2 struct {
F1 int32 F1 int32
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -1,14 +1,14 @@
package test package test
type Embedded1 struct { type embedded1 struct {
F1 int32 F1 int32
} }
type Embedded2 struct { type embedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type Embedded1 struct { type embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type Embedded2 struct { type embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
F1 int32 F1 int32
} }
type Embedded1 struct { type embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
F1 int32 F1 int32
} }
type Embedded2 struct { type embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -4,7 +4,7 @@ type DoubleEmbedded1 struct {
F1 int32 F1 int32
} }
type Embedded1 struct { type embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
@ -12,11 +12,11 @@ type DoubleEmbedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type Embedded2 struct { type embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
Embedded1 embedded1
Embedded2 embedded2
} }

View File

@ -1,15 +1,15 @@
package test package test
type typeForTest struct { 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 return nil
} }
func (t JM) MarshalJSON() ([]byte, error) { func (t jm) MarshalJSON() ([]byte, error) {
return []byte(`""`), nil return []byte(`""`), nil
} }

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler string type marshalerForTest string
func encode(str string) string { func encode(str string) string {
buf := bytes.Buffer{} buf := bytes.Buffer{}
@ -35,16 +35,16 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(string(m))), nil return []byte(`MANUAL__` + encode(string(m))), nil
} }
func (m *Marshaler) UnmarshalText(text []byte) error { func (m *marshalerForTest) UnmarshalText(text []byte) error {
*m = Marshaler(decode(strings.TrimPrefix(string(text), "MANUAL__"))) *m = marshalerForTest(decode(strings.TrimPrefix(string(text), "MANUAL__")))
return nil return nil
} }
var _ encoding.TextMarshaler = *new(Marshaler) var _ encoding.TextMarshaler = *new(marshalerForTest)
var _ encoding.TextUnmarshaler = new(Marshaler) var _ encoding.TextUnmarshaler = new(marshalerForTest)
type typeForTest Marshaler type typeForTest marshalerForTest

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,16 +37,16 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(m.X)), nil 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__")) m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
return nil return nil
} }
var _ encoding.TextMarshaler = Marshaler{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &Marshaler{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type typeForTest Marshaler type typeForTest marshalerForTest

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,18 +37,18 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(m.X)), nil 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__")) m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
return nil return nil
} }
var _ encoding.TextMarshaler = Marshaler{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &Marshaler{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type A Marshaler type A marshalerForTest
type typeForTest A type typeForTest A

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,20 +37,20 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(m.X)), nil 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__")) m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
return nil return nil
} }
var _ encoding.TextMarshaler = Marshaler{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &Marshaler{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type typeForTest struct { type typeForTest struct {
S string S string
M Marshaler M marshalerForTest
I int8 I int8
} }

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
) )
type Marshaler struct { type marshalerForTest struct {
X string X string
} }
@ -37,19 +37,19 @@ func decode(str string) string {
return string(bs) return string(bs)
} }
func (m Marshaler) MarshalText() ([]byte, error) { func (m marshalerForTest) MarshalText() ([]byte, error) {
return []byte(`MANUAL__` + encode(m.X)), nil 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__")) m.X = decode(strings.TrimPrefix(string(text), "MANUAL__"))
return nil return nil
} }
var _ encoding.TextMarshaler = Marshaler{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &Marshaler{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type A Marshaler type A marshalerForTest
type typeForTest struct { type typeForTest struct {
S string S string