Repository: go-kratos/kratos
Pull request #2746 (2023-03-18 13:41:06)

fix(kratos): linter
<!--
🎉 Thanks for sending a pull request to Kratos! Here are some tips for you:

1. If this is your first time contributing to Kratos, please read our contribution guide: https://go-kratos.dev/en/docs/community/contribution/
2. Ensure you have added or ran the appropriate tests and lint for your PR, please use `make lint` and `make test` before filing your PR, use `make clean` to tidy your go mod.
3. If the PR is unfinished, you may need to mark it as a WIP(Work In Progress) PR or Draft PR
4. Please use a semantic commits format title, such as `<type>[optional scope]: <description>`, see: https://go-kratos.dev/docs/community/contribution#type
5. at the same time, please note that similar work should be submitted in one PR as far as possible to reduce the workload of reviewers. Do not split a work into multiple PR unless it should.
-->

<!--
🎉 感谢您向 Kratos 发送 PR！以下是一些提示：
如果这是你第一次为 Kratos 贡献，请阅读我们的贡献指南：https://go-kratos.dev/en/docs/community/contribution/
2、确保您已经为您的 PR 添加或运行了适当的测试和lint，请在提交PR之前使用“make lint”和“make test”，使用“make clean”整理您的 go.mod。
3、如果 PR 未完成，您可能需要将其标记为 WIP（Work In Progress）PR 或 Draft PR
4、请使用语义提交格式标题，如“<类型>[可选范围]：<说明>`，请参阅：https://go-kratos.dev/docs/community/contribution#type
5. 同时请注意，同类的工作请尽量在一个PR中提交，以减轻 review 者的工作负担，不要把一项工作拆分成很多个PR，除非它应该这样做。
-->


#### Description (what this PR does / why we need it):
<img width="877" alt="image" src="https://user-images.githubusercontent.com/27986239/226110508-b00c53b3-9e2b-4961-9a46-c91d8efc3fec.png">


#### Which issue(s) this PR fixes (resolves / be part of):
<!--
* Automatically closes linked issue when PR is merged.
* If your PR is not fully resolved the issue, please use `part of #<issue number>` instead.

Usage: `fixes/resolves #<issue number>`, or `fixes/resolves (paste link of issue)`.
-->


#### Other special notes for the reviewers:
<!--
* Somethings that need extra attention for the reviewers
* Some additional notes, TODO list, etc.
-->


codecov-commenter: ## [Codecov](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) Report
> Merging [#2746](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (da9b07e) into [main](https://codecov.io/gh/go-kratos/kratos/commit/d05729399e23f3acd5215786c4b03f3430a52d82?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (d057293) will **not change** coverage.
> The diff coverage is `100.00%`.

> :exclamation: Current head da9b07e differs from pull request most recent head 33bfb2f. Consider uploading reports for the commit 33bfb2f to get more accurate results

:mega: This organization is not using Codecov’s [GitHub App Integration](https://github.com/apps/codecov). We recommend you install it so Codecov can continue to function properly for your repositories. [Learn more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos)

```diff
@@           Coverage Diff           @@
##             main    #2746   +/-   ##
=======================================
  Coverage   84.75%   84.75%           
=======================================
  Files          88       88           
  Lines        3897     3897           
=======================================
  Hits         3303     3303           
  Misses        419      419           
  Partials      175      175           
```


| [Impacted Files](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) | Coverage Δ | |
|---|---|---|
| [middleware/tracing/statsHandler.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-bWlkZGxld2FyZS90cmFjaW5nL3N0YXRzSGFuZGxlci5nbw==) | `100.00% <100.00%> (ø)` | |
| [selector/p2c/p2c.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3IvcDJjL3AyYy5nbw==) | `94.59% <100.00%> (ø)` | |
| [transport/grpc/resolver/direct/builder.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvcmVzb2x2ZXIvZGlyZWN0L2J1aWxkZXIuZ28=) | `100.00% <100.00%> (ø)` | |
| [transport/grpc/resolver/direct/resolver.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvcmVzb2x2ZXIvZGlyZWN0L3Jlc29sdmVyLmdv) | `100.00% <100.00%> (ø)` | |
| [transport/grpc/resolver/discovery/builder.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvcmVzb2x2ZXIvZGlzY292ZXJ5L2J1aWxkZXIuZ28=) | `90.00% <100.00%> (ø)` | |
| [transport/grpc/resolver/discovery/resolver.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvcmVzb2x2ZXIvZGlzY292ZXJ5L3Jlc29sdmVyLmdv) | `66.12% <100.00%> (ø)` | |
| [transport/grpc/server.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvc2VydmVyLmdv) | `83.83% <100.00%> (ø)` | |
| [transport/http/calloption.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2h0dHAvY2FsbG9wdGlvbi5nbw==) | `100.00% <100.00%> (ø)` | |
| [transport/http/client.go](https://codecov.io/gh/go-kratos/kratos/pull/2746?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2h0dHAvY2xpZW50Lmdv) | `84.21% <100.00%> (ø)` | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos)


Patch:
diff --git a/api/metadata/server.go b/api/metadata/server.go
index b1c4c17b..e3d5e373 100644
--- a/api/metadata/server.go
+++ b/api/metadata/server.go
@@ -98,7 +98,7 @@ func (s *Server) load() error {
 }
 
 // ListServices return all services
-func (s *Server) ListServices(ctx context.Context, in *ListServicesRequest) (*ListServicesReply, error) {
+func (s *Server) ListServices(_ context.Context, _ *ListServicesRequest) (*ListServicesReply, error) {
 	s.lock.Lock()
 	defer s.lock.Unlock()
 	if err := s.load(); err != nil {
@@ -122,7 +122,7 @@ func (s *Server) ListServices(ctx context.Context, in *ListServicesRequest) (*Li
 }
 
 // GetServiceDesc return service meta by name
-func (s *Server) GetServiceDesc(ctx context.Context, in *GetServiceDescRequest) (*GetServiceDescReply, error) {
+func (s *Server) GetServiceDesc(_ context.Context, in *GetServiceDescRequest) (*GetServiceDescReply, error) {
 	s.lock.Lock()
 	defer s.lock.Unlock()
 	if err := s.load(); err != nil {
diff --git a/cmd/kratos/internal/change/change.go b/cmd/kratos/internal/change/change.go
index 9327a179..2e92bee0 100644
--- a/cmd/kratos/internal/change/change.go
+++ b/cmd/kratos/internal/change/change.go
@@ -28,7 +28,7 @@ func init() {
 	token = os.Getenv("GITHUB_TOKEN")
 }
 
-func run(cmd *cobra.Command, args []string) {
+func run(_ *cobra.Command, args []string) {
 	owner, repo := ParseGithubURL(repoURL)
 	api := GithubAPI{Owner: owner, Repo: repo, Token: token}
 	version := "latest"
diff --git a/cmd/kratos/internal/project/project.go b/cmd/kratos/internal/project/project.go
index ce0e1ed4..f1f2cea0 100644
--- a/cmd/kratos/internal/project/project.go
+++ b/cmd/kratos/internal/project/project.go
@@ -42,7 +42,7 @@ func init() {
 	CmdNew.Flags().BoolVarP(&nomod, "nomod", "", nomod, "retain go mod")
 }
 
-func run(cmd *cobra.Command, args []string) {
+func run(_ *cobra.Command, args []string) {
 	wd, err := os.Getwd()
 	if err != nil {
 		panic(err)
diff --git a/cmd/kratos/internal/proto/add/add.go b/cmd/kratos/internal/proto/add/add.go
index e770dd5f..2415ab9d 100644
--- a/cmd/kratos/internal/proto/add/add.go
+++ b/cmd/kratos/internal/proto/add/add.go
@@ -19,7 +19,7 @@ var CmdAdd = &cobra.Command{
 	Run:   run,
 }
 
-func run(cmd *cobra.Command, args []string) {
+func run(_ *cobra.Command, args []string) {
 	if len(args) == 0 {
 		fmt.Println("Please enter the proto file or directory")
 		return
diff --git a/cmd/kratos/internal/proto/client/client.go b/cmd/kratos/internal/proto/client/client.go
index 013f9f72..cb3f4a76 100644
--- a/cmd/kratos/internal/proto/client/client.go
+++ b/cmd/kratos/internal/proto/client/client.go
@@ -30,7 +30,7 @@ func init() {
 	CmdClient.Flags().StringVarP(&protoPath, "proto_path", "p", protoPath, "proto path")
 }
 
-func run(cmd *cobra.Command, args []string) {
+func run(_ *cobra.Command, args []string) {
 	if len(args) == 0 {
 		fmt.Println("Please enter the proto file or directory")
 		return
diff --git a/cmd/kratos/internal/proto/server/server.go b/cmd/kratos/internal/proto/server/server.go
index e9af0c71..41fb9ee7 100644
--- a/cmd/kratos/internal/proto/server/server.go
+++ b/cmd/kratos/internal/proto/server/server.go
@@ -26,7 +26,7 @@ func init() {
 	CmdServer.Flags().StringVarP(&targetDir, "target-dir", "t", "internal/service", "generate target directory")
 }
 
-func run(cmd *cobra.Command, args []string) {
+func run(_ *cobra.Command, args []string) {
 	if len(args) == 0 {
 		fmt.Fprintln(os.Stderr, "Please specify the proto file. Example: kratos proto server api/xxx.proto")
 		return
diff --git a/cmd/kratos/internal/upgrade/upgrade.go b/cmd/kratos/internal/upgrade/upgrade.go
index 79e53e3c..20e368da 100644
--- a/cmd/kratos/internal/upgrade/upgrade.go
+++ b/cmd/kratos/internal/upgrade/upgrade.go
@@ -17,7 +17,7 @@ var CmdUpgrade = &cobra.Command{
 }
 
 // Run upgrade the kratos tools.
-func Run(cmd *cobra.Command, args []string) {
+func Run(_ *cobra.Command, _ []string) {
 	err := base.GoInstall(
 		"github.com/go-kratos/kratos/cmd/kratos/v2@latest",
 		"github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest",
diff --git a/cmd/protoc-gen-go-errors/errors.go b/cmd/protoc-gen-go-errors/errors.go
index 522c2968..f09c89ea 100644
--- a/cmd/protoc-gen-go-errors/errors.go
+++ b/cmd/protoc-gen-go-errors/errors.go
@@ -59,7 +59,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.
 	}
 }
 
-func genErrorsReason(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, enum *protogen.Enum) bool {
+func genErrorsReason(_ *protogen.Plugin, _ *protogen.File, g *protogen.GeneratedFile, enum *protogen.Enum) bool {
 	defaultCode := proto.GetExtension(enum.Desc.Options(), errors.E_DefaultCode)
 	code := 0
 	if ok := defaultCode.(int32); ok != 0 {
diff --git a/cmd/protoc-gen-go-http/http.go b/cmd/protoc-gen-go-http/http.go
index 7a4ff712..8d799a3b 100644
--- a/cmd/protoc-gen-go-http/http.go
+++ b/cmd/protoc-gen-go-http/http.go
@@ -63,7 +63,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.
 	}
 }
 
-func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, service *protogen.Service, omitempty bool) {
+func genService(_ *protogen.Plugin, file *protogen.File, g *protogen.GeneratedFile, service *protogen.Service, omitempty bool) {
 	if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() {
 		g.P("//")
 		g.P(deprecationComment)
diff --git a/config/options.go b/config/options.go
index e89a6fca..443ddaba 100644
--- a/config/options.go
+++ b/config/options.go
@@ -51,7 +51,7 @@ func WithResolver(r Resolver) Option {
 
 // WithLogger with config logger.
 // Deprecated: use global logger instead.
-func WithLogger(l log.Logger) Option {
+func WithLogger(_ log.Logger) Option {
 	return func(o *options) {}
 }
 
diff --git a/contrib/config/apollo/apollo.go b/contrib/config/apollo/apollo.go
index d463df29..1734fdb0 100644
--- a/contrib/config/apollo/apollo.go
+++ b/contrib/config/apollo/apollo.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/apolloconfig/agollo/v4"
 	"github.com/apolloconfig/agollo/v4/constant"
-	apolloConfig "github.com/apolloconfig/agollo/v4/env/config"
+	apolloconfig "github.com/apolloconfig/agollo/v4/env/config"
 	"github.com/apolloconfig/agollo/v4/extension"
 
 	"github.com/go-kratos/kratos/v2/config"
@@ -112,8 +112,8 @@ func NewSource(opts ...Option) config.Source {
 	for _, o := range opts {
 		o(&op)
 	}
-	client, err := agollo.StartWithConfig(func() (*apolloConfig.AppConfig, error) {
-		return &apolloConfig.AppConfig{
+	client, err := agollo.StartWithConfig(func() (*apolloconfig.AppConfig, error) {
+		return &apolloconfig.AppConfig{
 			AppID:            op.appid,
 			Cluster:          op.cluster,
 			NamespaceName:    op.namespace,
@@ -166,14 +166,13 @@ func (e *apollo) load() []*config.KeyValue {
 			}
 			kvs = append(kvs, kv)
 			continue
-		} else {
-			kv, err := e.getConfig(ns)
-			if err != nil {
-				log.Errorf("apollo get config failed，err:%v", err)
-				continue
-			}
-			kvs = append(kvs, kv)
 		}
+		kv, err := e.getConfig(ns)
+		if err != nil {
+			log.Errorf("apollo get config failed，err:%v", err)
+			continue
+		}
+		kvs = append(kvs, kv)
 	}
 	return kvs
 }
diff --git a/contrib/config/apollo/watcher.go b/contrib/config/apollo/watcher.go
index d59bdd21..ad842420 100644
--- a/contrib/config/apollo/watcher.go
+++ b/contrib/config/apollo/watcher.go
@@ -72,7 +72,7 @@ func (c *customChangeListener) OnChange(changeEvent *storage.ChangeEvent) {
 	c.in <- change
 }
 
-func (c *customChangeListener) OnNewestChange(changeEvent *storage.FullChangeEvent) {}
+func (c *customChangeListener) OnNewestChange(_ *storage.FullChangeEvent) {}
 
 func newWatcher(a *apollo) (config.Watcher, error) {
 	changeCh := make(chan []*config.KeyValue)
diff --git a/contrib/config/consul/watcher.go b/contrib/config/consul/watcher.go
index 5c70d6f8..5562505c 100644
--- a/contrib/config/consul/watcher.go
+++ b/contrib/config/consul/watcher.go
@@ -18,7 +18,7 @@ type watcher struct {
 	cancel context.CancelFunc
 }
 
-func (w *watcher) handle(idx uint64, data interface{}) {
+func (w *watcher) handle(_ uint64, data interface{}) {
 	if data == nil {
 		return
 	}
diff --git a/contrib/metrics/datadog/gauge.go b/contrib/metrics/datadog/gauge.go
index fbff772b..86912f92 100644
--- a/contrib/metrics/datadog/gauge.go
+++ b/contrib/metrics/datadog/gauge.go
@@ -39,8 +39,8 @@ func (d *gauge) Set(value float64) {
 	_ = d.opts.client.Gauge(d.name, value, d.lvs, d.opts.sampleRate)
 }
 
-func (d *gauge) Add(delta float64) {
+func (d *gauge) Add(_ float64) {
 }
 
-func (d *gauge) Sub(delta float64) {
+func (d *gauge) Sub(_ float64) {
 }
diff --git a/contrib/registry/discovery/discovery.go b/contrib/registry/discovery/discovery.go
index f439b0ca..bbacd7bb 100644
--- a/contrib/registry/discovery/discovery.go
+++ b/contrib/registry/discovery/discovery.go
@@ -427,7 +427,7 @@ func (r *Resolve) Watch() <-chan struct{} {
 }
 
 // fetch resolver instance.
-func (r *Resolve) fetch(ctx context.Context) (ins *disInstancesInfo, ok bool) {
+func (r *Resolve) fetch(_ context.Context) (ins *disInstancesInfo, ok bool) {
 	r.d.mutex.RLock()
 	app, ok := r.d.apps[r.id]
 	r.d.mutex.RUnlock()
diff --git a/contrib/registry/discovery/impl_registrar.go b/contrib/registry/discovery/impl_registrar.go
index bb580cc1..c4af66b7 100644
--- a/contrib/registry/discovery/impl_registrar.go
+++ b/contrib/registry/discovery/impl_registrar.go
@@ -122,7 +122,7 @@ func (d *Discovery) register(ctx context.Context, ins *discoveryInstance) (err e
 	return
 }
 
-func (d *Discovery) Deregister(ctx context.Context, service *registry.ServiceInstance) error {
+func (d *Discovery) Deregister(_ context.Context, service *registry.ServiceInstance) error {
 	ins := fromServerInstance(service, d.config)
 	return d.cancel(ins)
 }
diff --git a/contrib/registry/kubernetes/registry.go b/contrib/registry/kubernetes/registry.go
index 987ef1e1..21562dc5 100644
--- a/contrib/registry/kubernetes/registry.go
+++ b/contrib/registry/kubernetes/registry.go
@@ -151,14 +151,14 @@ func (s *Registry) Register(ctx context.Context, service *registry.ServiceInstan
 }
 
 // Deregister the registration.
-func (s *Registry) Deregister(ctx context.Context, service *registry.ServiceInstance) error {
+func (s *Registry) Deregister(ctx context.Context, _ *registry.ServiceInstance) error {
 	return s.Register(ctx, &registry.ServiceInstance{
 		Metadata: map[string]string{},
 	})
 }
 
 // GetService return the service instances in memory according to the service name.
-func (s *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error) {
+func (s *Registry) GetService(_ context.Context, name string) ([]*registry.ServiceInstance, error) {
 	pods, err := s.podLister.List(labels.SelectorFromSet(map[string]string{
 		LabelsKeyServiceName: name,
 	}))
diff --git a/contrib/registry/zookeeper/register.go b/contrib/registry/zookeeper/register.go
index 8f21745d..0e4ff0bb 100644
--- a/contrib/registry/zookeeper/register.go
+++ b/contrib/registry/zookeeper/register.go
@@ -59,7 +59,7 @@ func New(conn *zk.Conn, opts ...Option) *Registry {
 	}
 }
 
-func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) error {
+func (r *Registry) Register(_ context.Context, service *registry.ServiceInstance) error {
 	var (
 		data []byte
 		err  error
@@ -100,7 +100,7 @@ func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInst
 }
 
 // GetService get services from zookeeper
-func (r *Registry) GetService(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
+func (r *Registry) GetService(_ context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
 	instances, err, _ := r.group.Do(serviceName, func() (interface{}, error) {
 		serviceNamePath := path.Join(r.opts.namespace, serviceName)
 		servicesID, _, err := r.conn.Children(serviceNamePath)
diff --git a/log/log.go b/log/log.go
index bbaf94da..5022ba4b 100644
--- a/log/log.go
+++ b/log/log.go
@@ -27,10 +27,7 @@ func (c *logger) Log(level Level, keyvals ...interface{}) error {
 		bindValues(c.ctx, kvs)
 	}
 	kvs = append(kvs, keyvals...)
-	if err := c.logger.Log(level, kvs...); err != nil {
-		return err
-	}
-	return nil
+	return c.logger.Log(level, kvs...)
 }
 
 // With with logger fields.
diff --git a/middleware/tracing/statsHandler.go b/middleware/tracing/statsHandler.go
index b9ee3fd1..594be9e1 100644
--- a/middleware/tracing/statsHandler.go
+++ b/middleware/tracing/statsHandler.go
@@ -13,12 +13,12 @@ import (
 type ClientHandler struct{}
 
 // HandleConn exists to satisfy gRPC stats.Handler.
-func (c *ClientHandler) HandleConn(ctx context.Context, cs stats.ConnStats) {
+func (c *ClientHandler) HandleConn(_ context.Context, _ stats.ConnStats) {
 	fmt.Println("Handle connection.")
 }
 
 // TagConn exists to satisfy gRPC stats.Handler.
-func (c *ClientHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context {
+func (c *ClientHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context {
 	return ctx
 }
 
@@ -38,6 +38,6 @@ func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
 }
 
 // TagRPC implements per-RPC context management.
-func (c *ClientHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context {
+func (c *ClientHandler) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context {
 	return ctx
 }
diff --git a/middleware/tracing/tracer.go b/middleware/tracing/tracer.go
index 798994f8..b4455309 100644
--- a/middleware/tracing/tracer.go
+++ b/middleware/tracing/tracer.go
@@ -60,7 +60,7 @@ func (t *Tracer) Start(ctx context.Context, operation string, carrier propagatio
 }
 
 // End finish tracing span
-func (t *Tracer) End(ctx context.Context, span trace.Span, m interface{}, err error) {
+func (t *Tracer) End(_ context.Context, span trace.Span, m interface{}, err error) {
 	if err != nil {
 		span.RecordError(err)
 		if e := errors.FromError(err); e != nil {
diff --git a/selector/p2c/p2c.go b/selector/p2c/p2c.go
index 5e339b0c..1d0ef8c5 100644
--- a/selector/p2c/p2c.go
+++ b/selector/p2c/p2c.go
@@ -51,7 +51,7 @@ func (s *Balancer) prePick(nodes []selector.WeightedNode) (nodeA selector.Weight
 }
 
 // Pick pick a node.
-func (s *Balancer) Pick(ctx context.Context, nodes []selector.WeightedNode) (selector.WeightedNode, selector.DoneFunc, error) {
+func (s *Balancer) Pick(_ context.Context, nodes []selector.WeightedNode) (selector.WeightedNode, selector.DoneFunc, error) {
 	if len(nodes) == 0 {
 		return nil, nil, selector.ErrNoAvailable
 	}
diff --git a/transport/grpc/client.go b/transport/grpc/client.go
index 2d614cb0..a7a00910 100644
--- a/transport/grpc/client.go
+++ b/transport/grpc/client.go
@@ -105,7 +105,7 @@ func WithNodeFilter(filters ...selector.NodeFilter) ClientOption {
 
 // WithLogger with logger
 // Deprecated: use global logger instead.
-func WithLogger(log log.Logger) ClientOption {
+func WithLogger(_ log.Logger) ClientOption {
 	return func(o *clientOptions) {}
 }
 
diff --git a/transport/grpc/resolver/direct/builder.go b/transport/grpc/resolver/direct/builder.go
index 6035e2d5..ebbd22d7 100644
--- a/transport/grpc/resolver/direct/builder.go
+++ b/transport/grpc/resolver/direct/builder.go
@@ -20,7 +20,7 @@ func NewBuilder() resolver.Builder {
 	return &directBuilder{}
 }
 
-func (d *directBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
+func (d *directBuilder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
 	addrs := make([]resolver.Address, 0)
 	for _, addr := range strings.Split(strings.TrimPrefix(target.URL.Path, "/"), ",") {
 		addrs = append(addrs, resolver.Address{Addr: addr})
diff --git a/transport/grpc/resolver/direct/resolver.go b/transport/grpc/resolver/direct/resolver.go
index 7d18228c..e2dce618 100644
--- a/transport/grpc/resolver/direct/resolver.go
+++ b/transport/grpc/resolver/direct/resolver.go
@@ -11,5 +11,5 @@ func newDirectResolver() resolver.Resolver {
 func (r *directResolver) Close() {
 }
 
-func (r *directResolver) ResolveNow(options resolver.ResolveNowOptions) {
+func (r *directResolver) ResolveNow(_ resolver.ResolveNowOptions) {
 }
diff --git a/transport/grpc/resolver/discovery/builder.go b/transport/grpc/resolver/discovery/builder.go
index 37a9b560..28aff384 100644
--- a/transport/grpc/resolver/discovery/builder.go
+++ b/transport/grpc/resolver/discovery/builder.go
@@ -76,7 +76,7 @@ func NewBuilder(d registry.Discovery, opts ...Option) resolver.Builder {
 	return b
 }
 
-func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
+func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
 	watchRes := &struct {
 		err error
 		w   registry.Watcher
diff --git a/transport/grpc/resolver/discovery/resolver.go b/transport/grpc/resolver/discovery/resolver.go
index c50c65cb..03c76664 100644
--- a/transport/grpc/resolver/discovery/resolver.go
+++ b/transport/grpc/resolver/discovery/resolver.go
@@ -104,7 +104,7 @@ func (r *discoveryResolver) Close() {
 	}
 }
 
-func (r *discoveryResolver) ResolveNow(options resolver.ResolveNowOptions) {}
+func (r *discoveryResolver) ResolveNow(_ resolver.ResolveNowOptions) {}
 
 func parseAttributes(md map[string]string) (a *attributes.Attributes) {
 	for k, v := range md {
diff --git a/transport/grpc/server.go b/transport/grpc/server.go
index 4c3deccf..9a8344bf 100644
--- a/transport/grpc/server.go
+++ b/transport/grpc/server.go
@@ -56,7 +56,7 @@ func Timeout(timeout time.Duration) ServerOption {
 
 // Logger with server logger.
 // Deprecated: use global logger instead.
-func Logger(logger log.Logger) ServerOption {
+func Logger(_ log.Logger) ServerOption {
 	return func(s *Server) {}
 }
 
@@ -210,7 +210,7 @@ func (s *Server) Start(ctx context.Context) error {
 }
 
 // Stop stop the gRPC server.
-func (s *Server) Stop(ctx context.Context) error {
+func (s *Server) Stop(_ context.Context) error {
 	if s.adminClean != nil {
 		s.adminClean()
 	}
diff --git a/transport/http/calloption.go b/transport/http/calloption.go
index 7b0ed82d..e8329410 100644
--- a/transport/http/calloption.go
+++ b/transport/http/calloption.go
@@ -102,7 +102,7 @@ type HeaderCallOption struct {
 	header *http.Header
 }
 
-func (o HeaderCallOption) after(c *callInfo, cs *csAttempt) {
+func (o HeaderCallOption) after(_ *callInfo, cs *csAttempt) {
 	if cs.res != nil && cs.res.Header != nil {
 		*o.header = cs.res.Header
 	}
diff --git a/transport/http/client.go b/transport/http/client.go
index 52ee1350..2d2a352c 100644
--- a/transport/http/client.go
+++ b/transport/http/client.go
@@ -327,7 +327,7 @@ func (client *Client) Close() error {
 }
 
 // DefaultRequestEncoder is an HTTP request encoder.
-func DefaultRequestEncoder(ctx context.Context, contentType string, in interface{}) ([]byte, error) {
+func DefaultRequestEncoder(_ context.Context, contentType string, in interface{}) ([]byte, error) {
 	name := httputil.ContentSubtype(contentType)
 	body, err := encoding.GetCodec(name).Marshal(in)
 	if err != nil {
@@ -337,7 +337,7 @@ func DefaultRequestEncoder(ctx context.Context, contentType string, in interface
 }
 
 // DefaultResponseDecoder is an HTTP response decoder.
-func DefaultResponseDecoder(ctx context.Context, res *http.Response, v interface{}) error {
+func DefaultResponseDecoder(_ context.Context, res *http.Response, v interface{}) error {
 	defer res.Body.Close()
 	data, err := io.ReadAll(res.Body)
 	if err != nil {
@@ -347,7 +347,7 @@ func DefaultResponseDecoder(ctx context.Context, res *http.Response, v interface
 }
 
 // DefaultErrorDecoder is an HTTP error decoder.
-func DefaultErrorDecoder(ctx context.Context, res *http.Response) error {
+func DefaultErrorDecoder(_ context.Context, res *http.Response) error {
 	if res.StatusCode >= 200 && res.StatusCode <= 299 {
 		return nil
 	}
diff --git a/transport/http/server.go b/transport/http/server.go
index 165bb99b..7b27d326 100644
--- a/transport/http/server.go
+++ b/transport/http/server.go
@@ -52,7 +52,7 @@ func Timeout(timeout time.Duration) ServerOption {
 
 // Logger with server logger.
 // Deprecated: use global logger instead.
-func Logger(logger log.Logger) ServerOption {
+func Logger(_ log.Logger) ServerOption {
 	return func(s *Server) {}
 }
 


Test patch:
diff --git a/app_test.go b/app_test.go
index 92a2ca29..05e10134 100644
--- a/app_test.go
+++ b/app_test.go
@@ -19,7 +19,7 @@ type mockRegistry struct {
 	service map[string]*registry.ServiceInstance
 }
 
-func (r *mockRegistry) Register(ctx context.Context, service *registry.ServiceInstance) error {
+func (r *mockRegistry) Register(_ context.Context, service *registry.ServiceInstance) error {
 	if service == nil || service.ID == "" {
 		return errors.New("no service id")
 	}
@@ -30,7 +30,7 @@ func (r *mockRegistry) Register(ctx context.Context, service *registry.ServiceIn
 }
 
 // Deregister the registration.
-func (r *mockRegistry) Deregister(ctx context.Context, service *registry.ServiceInstance) error {
+func (r *mockRegistry) Deregister(_ context.Context, service *registry.ServiceInstance) error {
 	r.lk.Lock()
 	defer r.lk.Unlock()
 	if r.service[service.ID] == nil {
diff --git a/contrib/log/aliyun/aliyun_test.go b/contrib/log/aliyun/aliyun_test.go
index e3e224ad..d8c914ba 100644
--- a/contrib/log/aliyun/aliyun_test.go
+++ b/contrib/log/aliyun/aliyun_test.go
@@ -58,7 +58,7 @@ func TestWithAccessSecret(t *testing.T) {
 	}
 }
 
-func TestLogger(t *testing.T) {
+func TestLogger(_ *testing.T) {
 	project := "foo"
 	logger := NewAliyunLog(WithProject(project))
 	defer logger.Close()
diff --git a/contrib/opensergo/opensergo_test.go b/contrib/opensergo/opensergo_test.go
index 70ffef8f..0a2165fb 100644
--- a/contrib/opensergo/opensergo_test.go
+++ b/contrib/opensergo/opensergo_test.go
@@ -23,7 +23,7 @@ type testMetadataServiceServer struct {
 	srvContractPb.UnimplementedMetadataServiceServer
 }
 
-func (m *testMetadataServiceServer) ReportMetadata(ctx context.Context, req *srvContractPb.ReportMetadataRequest) (*srvContractPb.ReportMetadataReply, error) {
+func (m *testMetadataServiceServer) ReportMetadata(_ context.Context, _ *srvContractPb.ReportMetadataRequest) (*srvContractPb.ReportMetadataReply, error) {
 	return &srvContractPb.ReportMetadataReply{}, nil
 }
 
diff --git a/contrib/registry/eureka/register_test.go b/contrib/registry/eureka/register_test.go
index 683b0c58..c8c340c8 100644
--- a/contrib/registry/eureka/register_test.go
+++ b/contrib/registry/eureka/register_test.go
@@ -11,7 +11,7 @@ import (
 	"github.com/go-kratos/kratos/v2/registry"
 )
 
-func TestRegistry(t *testing.T) {
+func TestRegistry(_ *testing.T) {
 	ctx := context.Background()
 	ctx, cancel := context.WithCancel(ctx)
 	s1 := &registry.ServiceInstance{
@@ -92,7 +92,7 @@ func do(r *Registry, s *registry.ServiceInstance) {
 	}
 }
 
-func TestLock(t *testing.T) {
+func TestLock(_ *testing.T) {
 	type me struct {
 		lock sync.Mutex
 	}
diff --git a/contrib/registry/servicecomb/registry_test.go b/contrib/registry/servicecomb/registry_test.go
index 4b4c2549..9e139492 100644
--- a/contrib/registry/servicecomb/registry_test.go
+++ b/contrib/registry/servicecomb/registry_test.go
@@ -19,13 +19,13 @@ func init() {
 
 type mockClient struct{}
 
-func (receiver *mockClient) WatchMicroService(microServiceID string, callback func(*sc.MicroServiceInstanceChangedEvent)) error {
+func (receiver *mockClient) WatchMicroService(_ string, _ func(*sc.MicroServiceInstanceChangedEvent)) error {
 	return nil
 }
 
 //nolint
-func (receiver *mockClient) FindMicroServiceInstances(consumerID,
-	appID, microServiceName, versionRule string, opts ...sc.CallOption,
+func (receiver *mockClient) FindMicroServiceInstances(_,
+	_, microServiceName, _ string, _ ...sc.CallOption,
 ) ([]*pb.MicroServiceInstance, error) {
 	if microServiceName == "KratosServicecomb" {
 		return []*pb.MicroServiceInstance{{}}, nil
@@ -33,23 +33,23 @@ func (receiver *mockClient) FindMicroServiceInstances(consumerID,
 	return nil, nil
 }
 
-func (receiver *mockClient) RegisterService(microService *pb.MicroService) (string, error) {
+func (receiver *mockClient) RegisterService(_ *pb.MicroService) (string, error) {
 	return "", nil
 }
 
-func (receiver *mockClient) RegisterMicroServiceInstance(microServiceInstance *pb.MicroServiceInstance) (string, error) {
+func (receiver *mockClient) RegisterMicroServiceInstance(_ *pb.MicroServiceInstance) (string, error) {
 	return "", nil
 }
 
-func (receiver *mockClient) Heartbeat(microServiceID, microServiceInstanceID string) (bool, error) {
+func (receiver *mockClient) Heartbeat(_, _ string) (bool, error) {
 	return true, nil
 }
 
-func (receiver *mockClient) UnregisterMicroServiceInstance(microServiceID, microServiceInstanceID string) (bool, error) {
+func (receiver *mockClient) UnregisterMicroServiceInstance(_, _ string) (bool, error) {
 	return true, nil
 }
 
-func (receiver *mockClient) GetMicroServiceID(appID, microServiceName, version, env string, opts ...sc.CallOption) (string, error) {
+func (receiver *mockClient) GetMicroServiceID(_, _, _, _ string, _ ...sc.CallOption) (string, error) {
 	return "", nil
 }
 
diff --git a/encoding/encoding_test.go b/encoding/encoding_test.go
index 1d79ebbd..9746788a 100644
--- a/encoding/encoding_test.go
+++ b/encoding/encoding_test.go
@@ -9,11 +9,11 @@ import (
 
 type codec struct{}
 
-func (c codec) Marshal(v interface{}) ([]byte, error) {
+func (c codec) Marshal(_ interface{}) ([]byte, error) {
 	panic("implement me")
 }
 
-func (c codec) Unmarshal(data []byte, v interface{}) error {
+func (c codec) Unmarshal(_ []byte, _ interface{}) error {
 	panic("implement me")
 }
 
diff --git a/log/filter_test.go b/log/filter_test.go
index 3e36deac..9258400c 100644
--- a/log/filter_test.go
+++ b/log/filter_test.go
@@ -6,7 +6,7 @@ import (
 	"testing"
 )
 
-func TestFilterAll(t *testing.T) {
+func TestFilterAll(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(NewFilter(logger,
 		FilterLevel(LevelDebug),
@@ -21,7 +21,7 @@ func TestFilterAll(t *testing.T) {
 	log.Warn("warn log")
 }
 
-func TestFilterLevel(t *testing.T) {
+func TestFilterLevel(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(NewFilter(NewFilter(logger, FilterLevel(LevelWarn))))
 	log.Log(LevelDebug, "msg1", "te1st debug")
@@ -31,7 +31,7 @@ func TestFilterLevel(t *testing.T) {
 	log.Warn("warn log")
 }
 
-func TestFilterCaller(t *testing.T) {
+func TestFilterCaller(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewFilter(logger)
 	_ = log.Log(LevelDebug, "msg1", "te1st debug")
@@ -39,19 +39,19 @@ func TestFilterCaller(t *testing.T) {
 	logHelper.Log(LevelDebug, "msg1", "te1st debug")
 }
 
-func TestFilterKey(t *testing.T) {
+func TestFilterKey(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(NewFilter(logger, FilterKey("password")))
 	log.Debugw("password", "123456")
 }
 
-func TestFilterValue(t *testing.T) {
+func TestFilterValue(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(NewFilter(logger, FilterValue("debug")))
 	log.Debugf("test %s", "debug")
 }
 
-func TestFilterFunc(t *testing.T) {
+func TestFilterFunc(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(NewFilter(logger, FilterFunc(testFilterFunc)))
 	log.Debug("debug level")
diff --git a/log/helper_test.go b/log/helper_test.go
index 0cb4ba87..c52f338b 100644
--- a/log/helper_test.go
+++ b/log/helper_test.go
@@ -7,7 +7,7 @@ import (
 	"testing"
 )
 
-func TestHelper(t *testing.T) {
+func TestHelper(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(logger)
 
@@ -21,14 +21,14 @@ func TestHelper(t *testing.T) {
 	log.Warnw("log", "test warn")
 }
 
-func TestHelperWithMsgKey(t *testing.T) {
+func TestHelperWithMsgKey(_ *testing.T) {
 	logger := With(DefaultLogger, "ts", DefaultTimestamp, "caller", DefaultCaller)
 	log := NewHelper(logger, WithMessageKey("message"))
 	log.Debugf("test %s", "debug")
 	log.Debugw("log", "test debug")
 }
 
-func TestHelperLevel(t *testing.T) {
+func TestHelperLevel(_ *testing.T) {
 	log := NewHelper(DefaultLogger)
 	log.Debug("test debug")
 	log.Info("test info")
@@ -62,7 +62,7 @@ func BenchmarkHelperPrintw(b *testing.B) {
 
 type traceKey struct{}
 
-func TestContext(t *testing.T) {
+func TestContext(_ *testing.T) {
 	logger := With(NewStdLogger(os.Stdout),
 		"trace", Trace(),
 	)
diff --git a/log/log_test.go b/log/log_test.go
index 38417f76..8221d9ef 100644
--- a/log/log_test.go
+++ b/log/log_test.go
@@ -5,13 +5,13 @@ import (
 	"testing"
 )
 
-func TestInfo(t *testing.T) {
+func TestInfo(_ *testing.T) {
 	logger := DefaultLogger
 	logger = With(logger, "ts", DefaultTimestamp)
 	logger = With(logger, "caller", DefaultCaller)
 	_ = logger.Log(LevelInfo, "key1", "value1")
 }
 
-func TestWithContext(t *testing.T) {
+func TestWithContext(_ *testing.T) {
 	WithContext(context.Background(), nil)
 }
diff --git a/log/std_test.go b/log/std_test.go
index e9da7730..2518a046 100644
--- a/log/std_test.go
+++ b/log/std_test.go
@@ -2,7 +2,7 @@ package log
 
 import "testing"
 
-func TestStdLogger(t *testing.T) {
+func TestStdLogger(_ *testing.T) {
 	logger := DefaultLogger
 	logger = With(logger, "caller", DefaultCaller, "ts", DefaultTimestamp)
 
diff --git a/middleware/circuitbreaker/circuitbreaker_test.go b/middleware/circuitbreaker/circuitbreaker_test.go
index 611419c7..3b27da1a 100644
--- a/middleware/circuitbreaker/circuitbreaker_test.go
+++ b/middleware/circuitbreaker/circuitbreaker_test.go
@@ -57,7 +57,7 @@ func Test_WithGroup(t *testing.T) {
 	}
 }
 
-func Test_Server(t *testing.T) {
+func TestServer(_ *testing.T) {
 	nextValid := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return "Hello valid", nil
 	}
diff --git a/middleware/metrics/metrics_test.go b/middleware/metrics/metrics_test.go
index 9cf261ce..72b3137d 100644
--- a/middleware/metrics/metrics_test.go
+++ b/middleware/metrics/metrics_test.go
@@ -21,7 +21,7 @@ type (
 	}
 )
 
-func (m *mockCounter) With(lvs ...string) metrics.Counter {
+func (m *mockCounter) With(_ ...string) metrics.Counter {
 	return m
 }
 
@@ -33,7 +33,7 @@ func (m *mockCounter) Add(delta float64) {
 	m.value += delta
 }
 
-func (m *mockObserver) With(lvs ...string) metrics.Observer {
+func (m *mockObserver) With(_ ...string) metrics.Observer {
 	return m
 }
 
diff --git a/middleware/ratelimit/ratelimit_test.go b/middleware/ratelimit/ratelimit_test.go
index 2e4e5bde..b1422347 100644
--- a/middleware/ratelimit/ratelimit_test.go
+++ b/middleware/ratelimit/ratelimit_test.go
@@ -40,7 +40,7 @@ func Test_WithLimiter(t *testing.T) {
 	}
 }
 
-func Test_Server(t *testing.T) {
+func TestServer(t *testing.T) {
 	nextValid := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return "Hello valid", nil
 	}
diff --git a/middleware/tracing/span_test.go b/middleware/tracing/span_test.go
index 110dc6f5..6929ece1 100644
--- a/middleware/tracing/span_test.go
+++ b/middleware/tracing/span_test.go
@@ -178,7 +178,7 @@ func Test_parseTarget(t *testing.T) {
 	}
 }
 
-func Test_setServerSpan(t *testing.T) {
+func TestSetServerSpan(_ *testing.T) {
 	ctx := context.Background()
 	_, span := trace.NewNoopTracerProvider().Tracer("Tracer").Start(ctx, "Spanname")
 
@@ -211,7 +211,7 @@ func Test_setServerSpan(t *testing.T) {
 	setServerSpan(ctx, span, m)
 }
 
-func Test_setClientSpan(t *testing.T) {
+func TestSetClientSpan(_ *testing.T) {
 	ctx := context.Background()
 	_, span := trace.NewNoopTracerProvider().Tracer("Tracer").Start(ctx, "Spanname")
 
diff --git a/middleware/tracing/statsHandler_test.go b/middleware/tracing/statsHandler_test.go
index d8a38dcd..ec7ea06a 100644
--- a/middleware/tracing/statsHandler_test.go
+++ b/middleware/tracing/statsHandler_test.go
@@ -14,7 +14,7 @@ type ctxKey string
 
 const testKey ctxKey = "MY_TEST_KEY"
 
-func Test_Client_HandleConn(t *testing.T) {
+func TestClient_HandleConn(_ *testing.T) {
 	(&ClientHandler{}).HandleConn(context.Background(), nil)
 }
 
@@ -47,7 +47,7 @@ func (m *mockSpan) SpanContext() trace.SpanContext {
 	return *m.mockSpanCtx
 }
 
-func Test_Client_HandleRPC(t *testing.T) {
+func TestClient_HandleRPC(_ *testing.T) {
 	client := &ClientHandler{}
 	ctx := context.Background()
 	rs := stats.OutHeader{}
diff --git a/middleware/tracing/tracer_test.go b/middleware/tracing/tracer_test.go
index af63844e..8983a073 100644
--- a/middleware/tracing/tracer_test.go
+++ b/middleware/tracing/tracer_test.go
@@ -10,7 +10,7 @@ import (
 	"github.com/go-kratos/kratos/v2/internal/testdata/binding"
 )
 
-func Test_NewTracer(t *testing.T) {
+func TestNewTracer(t *testing.T) {
 	tracer := NewTracer(trace.SpanKindClient, func(o *options) {
 		o.tracerProvider = trace.NewNoopTracerProvider()
 	})
@@ -29,7 +29,7 @@ func Test_NewTracer(t *testing.T) {
 	})
 }
 
-func Test_Tracer_End(t *testing.T) {
+func TestTracer_End(_ *testing.T) {
 	tracer := NewTracer(trace.SpanKindClient, func(o *options) {
 		o.tracerProvider = trace.NewNoopTracerProvider()
 	})
diff --git a/options_test.go b/options_test.go
index 60600173..e1b7288b 100644
--- a/options_test.go
+++ b/options_test.go
@@ -86,8 +86,8 @@ func TestLogger(t *testing.T) {
 
 type mockServer struct{}
 
-func (m *mockServer) Start(ctx context.Context) error { return nil }
-func (m *mockServer) Stop(ctx context.Context) error  { return nil }
+func (m *mockServer) Start(_ context.Context) error { return nil }
+func (m *mockServer) Stop(_ context.Context) error  { return nil }
 
 func TestServer(t *testing.T) {
 	o := &options{}
@@ -118,11 +118,11 @@ func TestSignal(t *testing.T) {
 
 type mockRegistrar struct{}
 
-func (m *mockRegistrar) Register(ctx context.Context, service *registry.ServiceInstance) error {
+func (m *mockRegistrar) Register(_ context.Context, _ *registry.ServiceInstance) error {
 	return nil
 }
 
-func (m *mockRegistrar) Deregister(ctx context.Context, service *registry.ServiceInstance) error {
+func (m *mockRegistrar) Deregister(_ context.Context, _ *registry.ServiceInstance) error {
 	return nil
 }
 
diff --git a/selector/selector_test.go b/selector/selector_test.go
index ca30fc0a..b7b963f0 100644
--- a/selector/selector_test.go
+++ b/selector/selector_test.go
@@ -71,7 +71,7 @@ func (b *mockBalancerBuilder) Build() Balancer {
 
 type mockBalancer struct{}
 
-func (b *mockBalancer) Pick(ctx context.Context, nodes []WeightedNode) (selected WeightedNode, done DoneFunc, err error) {
+func (b *mockBalancer) Pick(_ context.Context, nodes []WeightedNode) (selected WeightedNode, done DoneFunc, err error) {
 	if len(nodes) == 0 {
 		err = ErrNoAvailable
 		return
@@ -90,7 +90,7 @@ func (b *mockMustErrorBalancerBuilder) Build() Balancer {
 
 type mockMustErrorBalancer struct{}
 
-func (b *mockMustErrorBalancer) Pick(ctx context.Context, nodes []WeightedNode) (selected WeightedNode, done DoneFunc, err error) {
+func (b *mockMustErrorBalancer) Pick(_ context.Context, _ []WeightedNode) (selected WeightedNode, done DoneFunc, err error) {
 	return nil, nil, errNodeNotMatch
 }
 
diff --git a/transport/grpc/client_test.go b/transport/grpc/client_test.go
index 7ad55368..b2e5e377 100644
--- a/transport/grpc/client_test.go
+++ b/transport/grpc/client_test.go
@@ -44,11 +44,11 @@ func TestWithMiddleware(t *testing.T) {
 
 type mockRegistry struct{}
 
-func (m *mockRegistry) GetService(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
+func (m *mockRegistry) GetService(_ context.Context, _ string) ([]*registry.ServiceInstance, error) {
 	return nil, nil
 }
 
-func (m *mockRegistry) Watch(ctx context.Context, serviceName string) (registry.Watcher, error) {
+func (m *mockRegistry) Watch(_ context.Context, _ string) (registry.Watcher, error) {
 	return nil, nil
 }
 
diff --git a/transport/grpc/resolver/direct/builder_test.go b/transport/grpc/resolver/direct/builder_test.go
index 82cd8cd1..d0a347df 100644
--- a/transport/grpc/resolver/direct/builder_test.go
+++ b/transport/grpc/resolver/direct/builder_test.go
@@ -29,11 +29,11 @@ func (m *mockConn) UpdateState(resolver.State) error {
 
 func (m *mockConn) ReportError(error) {}
 
-func (m *mockConn) NewAddress(addresses []resolver.Address) {}
+func (m *mockConn) NewAddress(_ []resolver.Address) {}
 
-func (m *mockConn) NewServiceConfig(serviceConfig string) {}
+func (m *mockConn) NewServiceConfig(_ string) {}
 
-func (m *mockConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
+func (m *mockConn) ParseServiceConfig(_ string) *serviceconfig.ParseResult {
 	return nil
 }
 
diff --git a/transport/grpc/resolver/discovery/builder_test.go b/transport/grpc/resolver/discovery/builder_test.go
index 21d5585c..e216a544 100644
--- a/transport/grpc/resolver/discovery/builder_test.go
+++ b/transport/grpc/resolver/discovery/builder_test.go
@@ -40,11 +40,11 @@ func TestDisableDebugLog(t *testing.T) {
 
 type mockDiscovery struct{}
 
-func (m *mockDiscovery) GetService(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
+func (m *mockDiscovery) GetService(_ context.Context, _ string) ([]*registry.ServiceInstance, error) {
 	return nil, nil
 }
 
-func (m *mockDiscovery) Watch(ctx context.Context, serviceName string) (registry.Watcher, error) {
+func (m *mockDiscovery) Watch(_ context.Context, _ string) (registry.Watcher, error) {
 	time.Sleep(time.Microsecond * 500)
 	return &testWatch{}, nil
 }
@@ -64,11 +64,11 @@ func (m *mockConn) UpdateState(resolver.State) error {
 
 func (m *mockConn) ReportError(error) {}
 
-func (m *mockConn) NewAddress(addresses []resolver.Address) {}
+func (m *mockConn) NewAddress(_ []resolver.Address) {}
 
-func (m *mockConn) NewServiceConfig(serviceConfig string) {}
+func (m *mockConn) NewServiceConfig(_ string) {}
 
-func (m *mockConn) ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult {
+func (m *mockConn) ParseServiceConfig(_ string) *serviceconfig.ParseResult {
 	return nil
 }
 
diff --git a/transport/grpc/server_test.go b/transport/grpc/server_test.go
index 4db44fe9..d9d2c7af 100644
--- a/transport/grpc/server_test.go
+++ b/transport/grpc/server_test.go
@@ -56,7 +56,7 @@ func (s *server) SayHelloStream(streamServer pb.Greeter_SayHelloStreamServer) er
 }
 
 // SayHello implements helloworld.GreeterServer
-func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
+func (s *server) SayHello(_ context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
 	if in.Name == "error" {
 		return nil, errors.BadRequest("custom_error", fmt.Sprintf("invalid argument %s", in.Name))
 	}
diff --git a/transport/http/client_test.go b/transport/http/client_test.go
index 119c8c0b..063878af 100644
--- a/transport/http/client_test.go
+++ b/transport/http/client_test.go
@@ -23,7 +23,7 @@ import (
 
 type mockRoundTripper struct{}
 
-func (rt *mockRoundTripper) RoundTrip(req *http.Request) (resp *http.Response, err error) {
+func (rt *mockRoundTripper) RoundTrip(_ *http.Request) (resp *http.Response, err error) {
 	return
 }
 
@@ -31,14 +31,14 @@ type mockCallOption struct {
 	needErr bool
 }
 
-func (x *mockCallOption) before(info *callInfo) error {
+func (x *mockCallOption) before(_ *callInfo) error {
 	if x.needErr {
 		return errors.New("option need return err")
 	}
 	return nil
 }
 
-func (x *mockCallOption) after(info *callInfo, attempt *csAttempt) {
+func (x *mockCallOption) after(_ *callInfo, _ *csAttempt) {
 	log.Println("run in mockCallOption.after")
 }
 
@@ -71,7 +71,8 @@ func TestWithBlock(t *testing.T) {
 	}
 }
 
-func TestWithBalancer(t *testing.T) {
+func TestWithBalancer(_ *testing.T) {
+	// TODO
 }
 
 func TestWithTLSConfig(t *testing.T) {
@@ -146,11 +147,11 @@ func TestWithErrorDecoder(t *testing.T) {
 
 type mockDiscovery struct{}
 
-func (*mockDiscovery) GetService(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
+func (*mockDiscovery) GetService(_ context.Context, _ string) ([]*registry.ServiceInstance, error) {
 	return nil, nil
 }
 
-func (*mockDiscovery) Watch(ctx context.Context, serviceName string) (registry.Watcher, error) {
+func (*mockDiscovery) Watch(_ context.Context, _ string) (registry.Watcher, error) {
 	return &mockWatcher{}, nil
 }
 
diff --git a/transport/http/resolver_test.go b/transport/http/resolver_test.go
index 4dfe3c5c..e1cfd103 100644
--- a/transport/http/resolver_test.go
+++ b/transport/http/resolver_test.go
@@ -57,7 +57,7 @@ func TestParseTarget(t *testing.T) {
 
 type mockRebalancer struct{}
 
-func (m *mockRebalancer) Apply(nodes []selector.Node) {}
+func (m *mockRebalancer) Apply(_ []selector.Node) {}
 
 type mockDiscoveries struct {
 	isSecure bool
@@ -65,7 +65,7 @@ type mockDiscoveries struct {
 	stopErr  bool
 }
 
-func (d *mockDiscoveries) GetService(ctx context.Context, serviceName string) ([]*registry.ServiceInstance, error) {
+func (d *mockDiscoveries) GetService(_ context.Context, _ string) ([]*registry.ServiceInstance, error) {
 	return nil, nil
 }
 
diff --git a/transport/http/router_test.go b/transport/http/router_test.go
index 747ebf05..1849939d 100644
--- a/transport/http/router_test.go
+++ b/transport/http/router_test.go
@@ -179,7 +179,7 @@ func TestRouter_Group(t *testing.T) {
 	}
 }
 
-func TestHandle(t *testing.T) {
+func TestHandle(_ *testing.T) {
 	r := newRouter("/", NewServer())
 	h := func(i Context) error {
 		return nil
diff --git a/transport/http/server_test.go b/transport/http/server_test.go
index 22865fc3..781c06a7 100644
--- a/transport/http/server_test.go
+++ b/transport/http/server_test.go
@@ -308,8 +308,8 @@ func TestTimeout(t *testing.T) {
 	}
 }
 
-func TestLogger(t *testing.T) {
-	// todo
+func TestLogger(_ *testing.T) {
+	// TODO
 }
 
 func TestRequestDecoder(t *testing.T) {