Bläddra i källkod

fix golint: do not export test types

Tao Wen 8 år sedan
förälder
incheckning
4351a2e6e9

+ 7 - 7
output_tests/json_marshal/string_alias/types.go

@@ -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

+ 4 - 4
output_tests/json_marshal/struct/types.go

@@ -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

+ 3 - 3
output_tests/json_marshal/struct_alias/types.go

@@ -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
 }

+ 3 - 3
output_tests/json_marshal/struct_field/types.go

@@ -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
 }

+ 3 - 3
output_tests/json_marshal/struct_field_alias/types.go

@@ -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
 }

+ 6 - 6
output_tests/struct/anonymous/no_overlap/json_marshal/types.go

@@ -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

+ 6 - 6
output_tests/struct/anonymous/no_overlap/text_marshal/types.go

@@ -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

+ 7 - 7
output_tests/struct/anonymous/overlap/ignore_deeper_level/types.go

@@ -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
 }

+ 4 - 4
output_tests/struct/anonymous/overlap/same_level_1_both_tagged/types.go

@@ -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
 }

+ 4 - 4
output_tests/struct/anonymous/overlap/same_level_1_no_tags/types.go

@@ -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
 }

+ 4 - 4
output_tests/struct/anonymous/overlap/same_level_1_tagged/types.go

@@ -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 - 4
output_tests/struct/anonymous/overlap/same_level_2_both_tagged/types.go

@@ -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 - 4
output_tests/struct/anonymous/overlap/same_level_2_no_tags/types.go

@@ -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 - 4
output_tests/struct/anonymous/overlap/same_level_2_tagged/types.go

@@ -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
 }

+ 4 - 4
output_tests/struct_tags/omitempty/string_json_marshal/types.go

@@ -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
output_tests/text_marshal/string_alias/types.go

@@ -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

+ 6 - 6
output_tests/text_marshal/struct/types.go

@@ -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

+ 6 - 6
output_tests/text_marshal/struct_alias/types.go

@@ -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

+ 6 - 6
output_tests/text_marshal/struct_field/types.go

@@ -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
 }

+ 6 - 6
output_tests/text_marshal/struct_field_alias/types.go

@@ -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