From e4d73db5236d046acff0b092f6ff30a2b3609c53 Mon Sep 17 00:00:00 2001 From: Kagaya Date: Wed, 10 Aug 2022 17:04:07 +0800 Subject: [PATCH] fix lint error (#2266) --- contrib/log/fluent/fluent.go | 5 +- contrib/registry/discovery/impl_registrar.go | 2 +- contrib/registry/kubernetes/registry.go | 62 ++++++++++---------- transport/grpc/resolver/direct/builder.go | 3 +- transport/grpc/server.go | 3 +- transport/http/server.go | 5 +- 6 files changed, 42 insertions(+), 38 deletions(-) diff --git a/contrib/log/fluent/fluent.go b/contrib/log/fluent/fluent.go index 8f385b594..07a15b869 100644 --- a/contrib/log/fluent/fluent.go +++ b/contrib/log/fluent/fluent.go @@ -99,8 +99,9 @@ type Logger struct { // NewLogger new a std logger with options. // target: -// tcp://127.0.0.1:24224 -// unix://var/run/fluent/fluent.sock +// +// tcp://127.0.0.1:24224 +// unix://var/run/fluent/fluent.sock func NewLogger(addr string, opts ...Option) (*Logger, error) { option := options{} for _, o := range opts { diff --git a/contrib/registry/discovery/impl_registrar.go b/contrib/registry/discovery/impl_registrar.go index c5590f57f..bb580cc14 100644 --- a/contrib/registry/discovery/impl_registrar.go +++ b/contrib/registry/discovery/impl_registrar.go @@ -62,7 +62,7 @@ func (d *Discovery) Register(ctx context.Context, service *registry.ServiceInsta return } -// register an instance with Discovery +// register an instance with Discovery func (d *Discovery) register(ctx context.Context, ins *discoveryInstance) (err error) { d.mutex.RLock() c := d.config diff --git a/contrib/registry/kubernetes/registry.go b/contrib/registry/kubernetes/registry.go index bd752bc13..6f08157d0 100644 --- a/contrib/registry/kubernetes/registry.go +++ b/contrib/registry/kubernetes/registry.go @@ -32,37 +32,37 @@ import ( // kratos-service-protocols: define the protocols of the service // // Example Deployment: -// -// apiVersion: apps/v1 -// kind: Deployment -// metadata: -// name: nginx -// labels: -// app: nginx -// spec: -// replicas: 5 -// selector: -// matchLabels: -// app: nginx -// template: -// metadata: -// labels: -// app: nginx -// kratos-service-id: "56991810-c77f-4a95-8190-393efa9c1a61" -// kratos-service-app: "nginx" -// kratos-service-version: "v3.5.0" -// annotations: -// kratos-service-protocols: | -// {"80": "http"} -// kratos-service-metadata: | -// {"region": "sh", "zone": "sh001", "cluster": "pd"} -// spec: -// containers: -// - name: nginx -// image: nginx:1.7.9 -// ports: -// - containerPort: 80 -// +/* +apiVersion: apps/v1 +kind: Deployment +metadata: +name: nginx +labels: + app: nginx +spec: +replicas: 5 +selector: + matchLabels: + app: nginx +template: + metadata: + labels: + app: nginx + kratos-service-id: "56991810-c77f-4a95-8190-393efa9c1a61" + kratos-service-app: "nginx" + kratos-service-version: "v3.5.0" + annotations: + kratos-service-protocols: | + {"80": "http"} + kratos-service-metadata: | + {"region": "sh", "zone": "sh001", "cluster": "pd"} + spec: + containers: + - name: nginx + image: nginx:1.7.9 + ports: + - containerPort: 80 +*/ const ( // LabelsKeyServiceID is used to define the ID of the service LabelsKeyServiceID = "kratos-service-id" diff --git a/transport/grpc/resolver/direct/builder.go b/transport/grpc/resolver/direct/builder.go index 1eb821649..6035e2d5f 100644 --- a/transport/grpc/resolver/direct/builder.go +++ b/transport/grpc/resolver/direct/builder.go @@ -14,7 +14,8 @@ type directBuilder struct{} // NewBuilder creates a directBuilder which is used to factory direct resolvers. // example: -// direct:///127.0.0.1:9000,127.0.0.2:9000 +// +// direct:///127.0.0.1:9000,127.0.0.2:9000 func NewBuilder() resolver.Builder { return &directBuilder{} } diff --git a/transport/grpc/server.go b/transport/grpc/server.go index b66ba932d..9e5ff17fd 100644 --- a/transport/grpc/server.go +++ b/transport/grpc/server.go @@ -176,7 +176,8 @@ func (s *Server) Use(selector string, m ...middleware.Middleware) { // Endpoint return a real address to registry endpoint. // examples: -// grpc://127.0.0.1:9000?isSecure=false +// +// grpc://127.0.0.1:9000?isSecure=false func (s *Server) Endpoint() (*url.URL, error) { if err := s.listenAndEndpoint(); err != nil { return nil, s.err diff --git a/transport/http/server.go b/transport/http/server.go index 4767e79b4..db7d0a723 100644 --- a/transport/http/server.go +++ b/transport/http/server.go @@ -256,8 +256,9 @@ func (s *Server) filter() mux.MiddlewareFunc { // Endpoint return a real address to registry endpoint. // examples: -// https://127.0.0.1:8000 -// Legacy: http://127.0.0.1:8000?isSecure=false +// +// https://127.0.0.1:8000 +// Legacy: http://127.0.0.1:8000?isSecure=false func (s *Server) Endpoint() (*url.URL, error) { if err := s.listenAndEndpoint(); err != nil { return nil, err