diff --git a/.golangci.yml b/.golangci.yml index ae14dfd1e..73ca1662f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,4 +8,6 @@ linters: enable: - revive - staticcheck - - govet \ No newline at end of file + - govet + - gosimple + - gofmt \ No newline at end of file diff --git a/cmd/kratos/internal/change/change.go b/cmd/kratos/internal/change/change.go index 3c132c117..647a54c9e 100644 --- a/cmd/kratos/internal/change/change.go +++ b/cmd/kratos/internal/change/change.go @@ -40,4 +40,4 @@ func run(cmd *cobra.Command, args []string) { info := api.GetReleaseInfo(version) fmt.Print(base.ParseReleaseInfo(info)) } -} \ No newline at end of file +} diff --git a/examples/http/echo/main.go b/examples/http/echo/main.go index 442645fdf..ed3599120 100644 --- a/examples/http/echo/main.go +++ b/examples/http/echo/main.go @@ -10,7 +10,7 @@ import ( func main() { router := echo.New() router.GET("/home", func(ctx echo.Context) error { - return ctx.JSON(200,"Hello echo") + return ctx.JSON(200, "Hello echo") }) httpSrv := http.NewServer(http.Address(":8000")) @@ -25,4 +25,4 @@ func main() { if err := app.Run(); err != nil { log.Fatal(err) } -} \ No newline at end of file +} diff --git a/examples/i18n/internal/pkg/middleware/localize/localize.go b/examples/i18n/internal/pkg/middleware/localize/localize.go index 949c4749c..c2d611bc3 100644 --- a/examples/i18n/internal/pkg/middleware/localize/localize.go +++ b/examples/i18n/internal/pkg/middleware/localize/localize.go @@ -32,4 +32,4 @@ func I18N() middleware.Middleware { func FromContext(ctx context.Context) *i18n.Localizer { return ctx.Value(localizerKey{}).(*i18n.Localizer) -} \ No newline at end of file +} diff --git a/examples/i18n/internal/service/greeter.go b/examples/i18n/internal/service/greeter.go index c344da498..030e4b52d 100644 --- a/examples/i18n/internal/service/greeter.go +++ b/examples/i18n/internal/service/greeter.go @@ -34,9 +34,9 @@ func (s *GreeterService) SayHello(ctx context.Context, in *v1.HelloRequest) (*v1 helloMsg, err := localizer.Localize(&i18n.LocalizeConfig{ DefaultMessage: &i18n.Message{ Description: "sayhello", - ID: "sayHello", - One: "Hello {{.Name}}", - Other: "Hello {{.Name}}", + ID: "sayHello", + One: "Hello {{.Name}}", + Other: "Hello {{.Name}}", }, TemplateData: map[string]interface{}{ "Name": in.Name, diff --git a/examples/registry/etcd/client/main.go b/examples/registry/etcd/client/main.go index 6c919aa36..e92bc5691 100644 --- a/examples/registry/etcd/client/main.go +++ b/examples/registry/etcd/client/main.go @@ -56,4 +56,4 @@ func callHTTP(r *registry.Registry) { log.Fatal(err) } log.Printf("[http] SayHello %+v\n", reply) -} \ No newline at end of file +} diff --git a/metadata/metadata.go b/metadata/metadata.go index 21b7547db..579f062cf 100644 --- a/metadata/metadata.go +++ b/metadata/metadata.go @@ -47,7 +47,7 @@ func (m Metadata) Set(key string, value string) { func (m Metadata) Range(f func(k, v string) bool) { for k, v := range m { ret := f(k, v) - if ret == false { + if !ret { break } } diff --git a/transport/http/binding/encode.go b/transport/http/binding/encode.go index f7a1564ed..61e040d0e 100644 --- a/transport/http/binding/encode.go +++ b/transport/http/binding/encode.go @@ -28,7 +28,7 @@ func EncodeURL(pathTemplate string, msg proto.Message, needQuery bool) string { if reg == nil { return pathTemplate } - pathParams := make(map[string]struct{}, 0) + pathParams := make(map[string]struct{}) path := reg.ReplaceAllStringFunc(pathTemplate, func(in string) string { if len(in) < 4 { return in