1
0
mirror of https://github.com/json-iterator/go.git synced 2025-03-20 20:54:55 +02:00

fix golint: do not export test types

This commit is contained in:
Tao Wen 2017-07-09 14:12:58 +08:00
parent 4351a2e6e9
commit 3b6853d209
61 changed files with 214 additions and 153 deletions

View File

@ -1,5 +1,5 @@
package test package test
type A struct{} type typeA struct{}
type typeForTest [4]A type typeForTest [4]typeA

View File

@ -46,9 +46,9 @@ func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
return nil return nil
} }
var _ json.Marshaler = Marshaler{} var _ json.Marshaler = marshalerForTest{}
var _ json.Unmarshaler = &Marshaler{} var _ json.Unmarshaler = &marshalerForTest{}
type A Marshaler type typeA marshalerForTest
type typeForTest A type typeForTest typeA

View File

@ -46,13 +46,13 @@ func (m *marshalerForTest) UnmarshalJSON(text []byte) error {
return nil return nil
} }
var _ json.Marshaler = Marshaler{} var _ json.Marshaler = marshalerForTest{}
var _ json.Unmarshaler = &Marshaler{} var _ json.Unmarshaler = &marshalerForTest{}
type A Marshaler type typeA marshalerForTest
type typeForTest struct { type typeForTest struct {
S string S string
M A M typeA
I int8 I int8
} }

View File

@ -1,6 +1,6 @@
package test package test
type Struct struct { type typeA struct {
String string String string
Int int32 Int int32
Float float64 Float float64
@ -11,4 +11,4 @@ type Struct struct {
Map map[string]string Map map[string]string
} }
type typeForTest map[string]*Struct type typeForTest map[string]*typeA

View File

@ -1,5 +1,5 @@
package test package test
type StringAlias string type stringAlias string
type typeForTest map[string]StringAlias type typeForTest map[string]stringAlias

View File

@ -1,5 +1,5 @@
package test package test
type A struct{} type typeA struct{}
type typeForTest map[string]A type typeForTest map[string]typeA

View File

@ -1,5 +1,5 @@
package test package test
type StringAlias string type stringAlias string
type typeForTest map[StringAlias]string type typeForTest map[stringAlias]string

View File

@ -1,5 +1,5 @@
package test package test
type StringAlias string type stringAlias string
type typeForTest map[StringAlias]StringAlias type typeForTest map[stringAlias]stringAlias

View File

@ -5,18 +5,18 @@ import (
"strings" "strings"
) )
type KeyType string type keyType string
func (k KeyType) MarshalText() ([]byte, error) { func (k keyType) MarshalText() ([]byte, error) {
return []byte("MANUAL__" + k), nil return []byte("MANUAL__" + k), nil
} }
func (k *KeyType) UnmarshalText(text []byte) error { func (k *keyType) UnmarshalText(text []byte) error {
*k = KeyType(strings.TrimPrefix(string(text), "MANUAL__")) *k = keyType(strings.TrimPrefix(string(text), "MANUAL__"))
return nil return nil
} }
var _ encoding.TextMarshaler = KeyType("") var _ encoding.TextMarshaler = keyType("")
var _ encoding.TextUnmarshaler = new(KeyType) var _ encoding.TextUnmarshaler = new(keyType)
type typeForTest map[KeyType]string type typeForTest map[keyType]string

View File

@ -5,20 +5,20 @@ import (
"strings" "strings"
) )
type KeyType struct { type keyType struct {
X string X string
} }
func (k KeyType) MarshalText() ([]byte, error) { func (k keyType) MarshalText() ([]byte, error) {
return []byte("MANUAL__" + k.X), nil return []byte("MANUAL__" + k.X), nil
} }
func (k *KeyType) UnmarshalText(text []byte) error { func (k *keyType) UnmarshalText(text []byte) error {
k.X = strings.TrimPrefix(string(text), "MANUAL__") k.X = strings.TrimPrefix(string(text), "MANUAL__")
return nil return nil
} }
var _ encoding.TextMarshaler = KeyType{} var _ encoding.TextMarshaler = keyType{}
var _ encoding.TextUnmarshaler = &KeyType{} var _ encoding.TextUnmarshaler = &keyType{}
type typeForTest map[KeyType]string type typeForTest map[keyType]string

View File

@ -1,5 +1,5 @@
package test package test
type A struct{} type typeA struct{}
type typeForTest []A type typeForTest []typeA

View File

@ -1,6 +1,6 @@
package test package test
type A struct { type typeA struct {
Byte1 byte Byte1 byte
Byte2 byte Byte2 byte
Bool1 bool Bool1 bool
@ -17,4 +17,4 @@ type A struct {
String2 string String2 string
} }
type typeForTest A type typeForTest typeA

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded float64 type Embedded float64
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded int32 type Embedded int32
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded map[string]string type Embedded map[string]string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded float64 type Embedded float64
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded int32 type Embedded int32
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded map[string]string type Embedded map[string]string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded []string type Embedded []string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded string type Embedded string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded struct { type Embedded struct {
String string String string
Int int32 Int int32

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded []string type Embedded []string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded string type Embedded string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded string type Embedded string
type typeForTest struct { type typeForTest struct {

View File

@ -1,5 +1,6 @@
package test package test
// Embedded TEST ONLY
type Embedded struct { type Embedded struct {
String string String string
Int int32 Int int32

View File

@ -1,9 +1,11 @@
package test package test
// E1 TEST ONLY
type E1 struct { type E1 struct {
F1 int32 F1 int32
} }
// E2 TEST ONLY
type E2 struct { type E2 struct {
F2 string F2 string
} }

View File

@ -1,20 +1,23 @@
package test package test
type doubleEmbedded struct { // DoubleEmbedded TEST ONLY
type DoubleEmbedded struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type embedded1 struct { // Embedded1 TEST ONLY
doubleEmbedded type Embedded1 struct {
DoubleEmbedded
F1 int32 F1 int32
} }
type embedded2 struct { // Embedded2 TEST ONLY
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,16 @@
package test package test
type embedded1 struct { // Embedded1 TEST ONLY
type Embedded1 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type embedded2 struct { // Embedded2 TEST ONLY
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,16 @@
package test package test
type embedded1 struct { // Embedded1 TEST ONLY
type Embedded1 struct {
F1 int32 F1 int32
} }
type embedded2 struct { // Embedded2 TEST ONLY
type Embedded2 struct {
F1 int32 F1 int32
} }
type typeForTest struct { type typeForTest struct {
embedded1 Embedded1
embedded2 Embedded2
} }

View File

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

View File

@ -1,22 +1,26 @@
package test package test
// DoubleEmbedded1 TEST ONLY
type DoubleEmbedded1 struct { type DoubleEmbedded1 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type embedded1 struct { // Embedded1 TEST ONLY
type Embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
// DoubleEmbedded2 TEST ONLY
type DoubleEmbedded2 struct { type DoubleEmbedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type embedded2 struct { // Embedded2 TEST ONLY
type Embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
embedded1 Embedded1
embedded2 Embedded2
} }

View File

@ -1,22 +1,26 @@
package test package test
// DoubleEmbedded1 TEST ONLY
type DoubleEmbedded1 struct { type DoubleEmbedded1 struct {
F1 int32 F1 int32
} }
type embedded1 struct { // Embedded1 TEST ONLY
type Embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
// DoubleEmbedded2 TEST ONLY
type DoubleEmbedded2 struct { type DoubleEmbedded2 struct {
F1 int32 F1 int32
} }
type embedded2 struct { // Embedded2 TEST ONLY
type Embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
embedded1 Embedded1
embedded2 Embedded2
} }

View File

@ -1,22 +1,26 @@
package test package test
// DoubleEmbedded1 TEST ONLY
type DoubleEmbedded1 struct { type DoubleEmbedded1 struct {
F1 int32 F1 int32
} }
type embedded1 struct { // Embedded1 TEST ONLY
type Embedded1 struct {
DoubleEmbedded1 DoubleEmbedded1
} }
// DoubleEmbedded2 TEST ONLY
type DoubleEmbedded2 struct { type DoubleEmbedded2 struct {
F1 int32 `json:"F1"` F1 int32 `json:"F1"`
} }
type embedded2 struct { // Embedded2 TEST ONLY
type Embedded2 struct {
DoubleEmbedded2 DoubleEmbedded2
} }
type typeForTest struct { type typeForTest struct {
embedded1 Embedded1
embedded2 Embedded2
} }

View File

@ -1,9 +1,9 @@
package test package test
type A1 string type typeA1 string
type A2 [4]A1 type typeA2 [4]typeA1
type typeForTest struct { type typeForTest struct {
F1 [4]A1 F1 [4]typeA1
F2 A2 F2 typeA2
} }

View File

@ -1,5 +1,5 @@
package test package test
type A struct{} type typeA struct{}
type typeForTest A type typeForTest typeA

View File

@ -1,7 +1,7 @@
package test package test
type A float64 type typeA float64
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,9 +1,9 @@
package test package test
type A float64 type typeA float64
type typeForTest struct { type typeForTest struct {
F1 A F1 typeA
F2 A F2 typeA
F3 A F3 typeA
} }

View File

@ -1,7 +1,7 @@
package test package test
type A int32 type typeA int32
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,9 +1,9 @@
package test package test
type A int32 type typeA int32
type typeForTest struct { type typeForTest struct {
F1 A F1 typeA
F2 A F2 typeA
F3 A F3 typeA
} }

View File

@ -1,10 +1,10 @@
package test package test
type A1 float64 type typeA1 float64
type A2 *float64 type typeA2 *float64
type typeForTest struct { type typeForTest struct {
F1 *A1 F1 *typeA1
F2 A2 F2 typeA2
F3 *A2 F3 *typeA2
} }

View File

@ -1,10 +1,11 @@
package test package test
type A1 int32 type typeA1 int32
type A2 *int32
type typeA2 *int32
type typeForTest struct { type typeForTest struct {
F1 *A1 F1 *typeA1
F2 A2 F2 typeA2
F3 *A2 F3 *typeA2
} }

View File

@ -1,10 +1,10 @@
package test package test
type A1 string type typeA1 string
type A2 *string type typeA2 *string
type typeForTest struct { type typeForTest struct {
F1 *A1 F1 *typeA1
F2 A2 F2 typeA2
F3 *A2 F3 *typeA2
} }

View File

@ -1,9 +1,9 @@
package test package test
type A1 string type typeA1 string
type A2 []A1 type typeA2 []typeA1
type typeForTest struct { type typeForTest struct {
F1 []A1 F1 []typeA1
F2 A2 F2 typeA2
} }

View File

@ -1,7 +1,7 @@
package test package test
type A string type typeA string
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,9 +1,9 @@
package test package test
type A string type typeA string
type typeForTest struct { type typeForTest struct {
F1 A F1 typeA
F2 A F2 typeA
F3 A F3 typeA
} }

View File

@ -1,7 +1,7 @@
package test package test
type A struct{} type typeA struct{}
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,9 +1,9 @@
package test package test
type A struct { type typeA struct {
F float64 F float64
} }
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,13 +1,13 @@
package test package test
type S string type typeS string
type A struct { type typeA struct {
F1 S F1 typeS
F2 S F2 typeS
F3 S F3 typeS
} }
type typeForTest struct { type typeForTest struct {
F A F typeA
} }

View File

@ -1,20 +1,31 @@
package test package test
// S1 TEST ONLY
type S1 struct { type S1 struct {
S1F string S1F string
} }
// S2 TEST ONLY
type S2 struct { type S2 struct {
S2F string S2F string
} }
// S3 TEST ONLY
type S3 struct { type S3 struct {
S3F string S3F string
} }
// S4 TEST ONLY
type S4 struct { type S4 struct {
S4F string S4F string
} }
// S5 TEST ONLY
type S5 struct { type S5 struct {
S5F string S5F string
} }
// S6 TEST ONLY
type S6 struct { type S6 struct {
S6F string S6F string
} }

View File

@ -1,5 +1,6 @@
package test package test
// E TEST ONLY
type E struct { type E struct {
E1 string E1 string
} }

View File

@ -1,20 +1,31 @@
package test package test
// S1 TEST ONLY
type S1 struct { type S1 struct {
S1F string S1F string
} }
// S2 TEST ONLY
type S2 struct { type S2 struct {
S2F string S2F string
} }
// S3 TEST ONLY
type S3 struct { type S3 struct {
S3F string S3F string
} }
// S4 TEST ONLY
type S4 struct { type S4 struct {
S4F string S4F string
} }
// S5 TEST ONLY
type S5 struct { type S5 struct {
S5F string S5F string
} }
// S6 TEST ONLY
type S6 struct { type S6 struct {
S6F string S6F string
} }

View File

@ -1,5 +1,6 @@
package test package test
// E TEST ONLY
type E struct { type E struct {
F string `json:"F,omitempty"` F string `json:"F,omitempty"`
} }

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

@ -1,15 +1,15 @@
package test package test
type typeForTest struct { type typeForTest struct {
F *TM `json:"f,omitempty"` F *tm `json:"f,omitempty"`
} }
type TM string type tm string
func (t *TM) UnmarshalText(b []byte) error { func (t *tm) UnmarshalText(b []byte) error {
return nil return nil
} }
func (t TM) MarshalText() ([]byte, error) { func (t tm) MarshalText() ([]byte, error) {
return []byte(`""`), nil return []byte(`""`), nil
} }

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 struct{} type jm struct{}
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

@ -1,15 +1,15 @@
package test package test
type typeForTest struct { type typeForTest struct {
F *TM `json:"f,omitempty"` F *tm `json:"f,omitempty"`
} }
type TM struct{} type tm struct{}
func (t *TM) UnmarshalText(b []byte) error { func (t *tm) UnmarshalText(b []byte) error {
return nil return nil
} }
func (t TM) MarshalText() ([]byte, error) { func (t tm) MarshalText() ([]byte, error) {
return []byte(`""`), nil return []byte(`""`), nil
} }

View File

@ -1,15 +1,15 @@
package test package test
type typeForTest struct { type typeForTest struct {
F TM `json:"f,omitempty"` F tm `json:"f,omitempty"`
} }
type TM string type tm string
func (t *TM) UnmarshalText(b []byte) error { func (t *tm) UnmarshalText(b []byte) error {
return nil return nil
} }
func (t TM) MarshalText() ([]byte, error) { func (t tm) MarshalText() ([]byte, error) {
return []byte(`""`), nil return []byte(`""`), nil
} }

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 struct{} type jm struct{}
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

@ -1,15 +1,15 @@
package test package test
type typeForTest struct { type typeForTest struct {
F TM `json:"f,omitempty"` F tm `json:"f,omitempty"`
} }
type TM struct{} type tm struct{}
func (t *TM) UnmarshalText(b []byte) error { func (t *tm) UnmarshalText(b []byte) error {
return nil return nil
} }
func (t TM) MarshalText() ([]byte, error) { func (t tm) MarshalText() ([]byte, error) {
return []byte(`""`), nil return []byte(`""`), nil
} }

View File

@ -49,6 +49,6 @@ func (m *marshalerForTest) UnmarshalText(text []byte) error {
var _ encoding.TextMarshaler = marshalerForTest{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &marshalerForTest{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type A marshalerForTest type marshalerAlias marshalerForTest
type typeForTest A type typeForTest marshalerAlias

View File

@ -49,10 +49,10 @@ func (m *marshalerForTest) UnmarshalText(text []byte) error {
var _ encoding.TextMarshaler = marshalerForTest{} var _ encoding.TextMarshaler = marshalerForTest{}
var _ encoding.TextUnmarshaler = &marshalerForTest{} var _ encoding.TextUnmarshaler = &marshalerForTest{}
type A marshalerForTest type marshalerAlias marshalerForTest
type typeForTest struct { type typeForTest struct {
S string S string
M A M marshalerAlias
I int8 I int8
} }