From 9b0625bb831d934edfeede727a70d288b291d868 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Mon, 8 Feb 2021 17:08:40 +0800 Subject: [PATCH] fix golint issues (#450) --- core/codec/aesecb_test.go | 1 + tools/goctl/api/javagen/genpacket.go | 2 +- tools/goctl/api/parser/g4/test/type_test.go | 4 ++-- tools/goctl/model/sql/builderx/builder.go | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/codec/aesecb_test.go b/core/codec/aesecb_test.go index 05852dd5..bb6e258f 100644 --- a/core/codec/aesecb_test.go +++ b/core/codec/aesecb_test.go @@ -58,6 +58,7 @@ func TestAesEcbBase64(t *testing.T) { _, err = EcbDecryptBase64(b64Key, val) assert.NotNil(t, err) src, err := EcbDecryptBase64(b64Key, dst) + assert.Nil(t, err) b, err := base64.StdEncoding.DecodeString(src) assert.Nil(t, err) assert.Equal(t, val, string(b)) diff --git a/tools/goctl/api/javagen/genpacket.go b/tools/goctl/api/javagen/genpacket.go index d5dc94b1..a6b17b90 100644 --- a/tools/goctl/api/javagen/genpacket.go +++ b/tools/goctl/api/javagen/genpacket.go @@ -107,7 +107,7 @@ func createWith(dir string, api *spec.ApiSpec, route spec.Route, packetName stri } _, err = fp.WriteString(formatSource(tmplBytes.String())) - return nil + return err } func doc(route spec.Route) string { diff --git a/tools/goctl/api/parser/g4/test/type_test.go b/tools/goctl/api/parser/g4/test/type_test.go index 9d8b457c..4e0cca5b 100644 --- a/tools/goctl/api/parser/g4/test/type_test.go +++ b/tools/goctl/api/parser/g4/test/type_test.go @@ -334,13 +334,13 @@ func TestTypeBlock(t *testing.T) { return p.TypeBlock().Accept(visitor) } t.Run("normal", func(t *testing.T) { - v, err := parser.Accept(fn, `type( + _, err := parser.Accept(fn, `type( // doc Foo int )`) assert.Error(t, err) - v, err = parser.Accept(fn, `type ( + v, err := parser.Accept(fn, `type ( // doc Foo { Bar int diff --git a/tools/goctl/model/sql/builderx/builder.go b/tools/goctl/model/sql/builderx/builder.go index 8e4ddd14..1c72e6d9 100644 --- a/tools/goctl/model/sql/builderx/builder.go +++ b/tools/goctl/model/sql/builderx/builder.go @@ -49,7 +49,7 @@ func ToMap(in interface{}) map[string]interface{} { return out } -// deprecated: use RawFieldNames instead automaticly while model generating after goctl version v1.1.0 +// deprecated: use RawFieldNames instead automatically while model generating after goctl version v1.1.0 func FieldNames(in interface{}) []string { out := make([]string, 0) v := reflect.ValueOf(in)