Repository: go-kratos/kratos
Pull request #2372 (2022-09-10 03:57:25)

feat: remove assert libraries
<!--
🎉 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、如果请购单未完成，您可能需要将其标记为 WIP（在制品）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):
<!--
* The description should include the motivation for this PR or contrast this with previous behavior
-->
remove assert libraries, avoid the use of `assert` libraries to help your tests
standard: https://github.com/golang/go/wiki/TestComments#assert-libraries

#### 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/2372?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) Report
> Merging [#2372](https://codecov.io/gh/go-kratos/kratos/pull/2372?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (bedb49c) into [main](https://codecov.io/gh/go-kratos/kratos/commit/667d63839c3924191497128afec9551212218d4a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (667d638) will **decrease** coverage by `0.05%`.
> The diff coverage is `n/a`.

> :exclamation: Current head bedb49c differs from pull request most recent head 8716da9. Consider uploading reports for the commit 8716da9 to get more accurate results

```diff
@@            Coverage Diff             @@
##             main    #2372      +/-   ##
==========================================
- Coverage   85.28%   85.23%   -0.06%     
==========================================
  Files          88       88              
  Lines        3778     3778              
==========================================
- Hits         3222     3220       -2     
- Misses        391      393       +2     
  Partials      165      165              
```


| [Impacted Files](https://codecov.io/gh/go-kratos/kratos/pull/2372?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) | Coverage Δ | |
|---|---|---|
| [internal/context/context.go](https://codecov.io/gh/go-kratos/kratos/pull/2372/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-aW50ZXJuYWwvY29udGV4dC9jb250ZXh0Lmdv) | `97.01% <0.00%> (-2.99%)` | :arrow_down: |

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/contrib/config/apollo/watcher.go b/contrib/config/apollo/watcher.go
index 670139a2..94ef2ef0 100644
--- a/contrib/config/apollo/watcher.go
+++ b/contrib/config/apollo/watcher.go
@@ -31,6 +31,7 @@ func (c *customChangeListener) onChange(namespace string, changes map[string]*st
 		value, err := c.apollo.client.GetConfigCache(namespace).Get("content")
 		if err != nil {
 			log.Warnw("apollo get config failed", "err", err)
+			return nil
 		}
 		kv = append(kv, &config.KeyValue{
 			Key:    namespace,
diff --git a/contrib/log/logrus/go.mod b/contrib/log/logrus/go.mod
index aa1f5946..c41e4ecc 100644
--- a/contrib/log/logrus/go.mod
+++ b/contrib/log/logrus/go.mod
@@ -5,7 +5,6 @@ go 1.16
 require (
 	github.com/go-kratos/kratos/v2 v2.5.0
 	github.com/sirupsen/logrus v1.8.1
-	github.com/stretchr/testify v1.7.1
 )
 
 replace github.com/go-kratos/kratos/v2 => ../../../
diff --git a/contrib/log/logrus/go.sum b/contrib/log/logrus/go.sum
index 129b0363..c8ee9b37 100644
--- a/contrib/log/logrus/go.sum
+++ b/contrib/log/logrus/go.sum
@@ -154,7 +154,6 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/contrib/registry/etcd/watcher.go b/contrib/registry/etcd/watcher.go
index 22e63474..a5bf63c4 100644
--- a/contrib/registry/etcd/watcher.go
+++ b/contrib/registry/etcd/watcher.go
@@ -7,7 +7,7 @@ import (
 	clientv3 "go.etcd.io/etcd/client/v3"
 )
 
-var _ registry.Watcher = &watcher{}
+var _ registry.Watcher = (*watcher)(nil)
 
 type watcher struct {
 	key         string
diff --git a/contrib/registry/eureka/client.go b/contrib/registry/eureka/client.go
index 35dd1472..f2b4e96f 100644
--- a/contrib/registry/eureka/client.go
+++ b/contrib/registry/eureka/client.go
@@ -82,7 +82,7 @@ type DataCenterInfo struct {
 	Class string `json:"@class"`
 }
 
-var _ APIInterface = new(Client)
+var _ APIInterface = (*Client)(nil)
 
 type APIInterface interface {
 	Register(ctx context.Context, ep Endpoint) error
diff --git a/contrib/registry/eureka/watcher.go b/contrib/registry/eureka/watcher.go
index 468d97b2..de37d322 100644
--- a/contrib/registry/eureka/watcher.go
+++ b/contrib/registry/eureka/watcher.go
@@ -6,7 +6,7 @@ import (
 	"github.com/go-kratos/kratos/v2/registry"
 )
 
-var _ registry.Watcher = &watcher{}
+var _ registry.Watcher = (*watcher)(nil)
 
 type watcher struct {
 	ctx        context.Context
diff --git a/contrib/registry/servicecomb/go.mod b/contrib/registry/servicecomb/go.mod
index 43661281..b5cb1c42 100644
--- a/contrib/registry/servicecomb/go.mod
+++ b/contrib/registry/servicecomb/go.mod
@@ -7,9 +7,5 @@ require (
 	github.com/go-chassis/sc-client v0.6.1-0.20210615014358-a45e9090c751
 	github.com/go-kratos/kratos/v2 v2.3.1
 	github.com/gofrs/uuid v4.2.0+incompatible
-)
-
-require (
-	github.com/stretchr/testify v1.7.1
 	golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4
 )
diff --git a/contrib/registry/servicecomb/go.sum b/contrib/registry/servicecomb/go.sum
index 738943db..015d1508 100644
--- a/contrib/registry/servicecomb/go.sum
+++ b/contrib/registry/servicecomb/go.sum
@@ -137,9 +137,7 @@ github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+
 github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
 github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
 github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
-github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
 github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
-github.com/go-playground/form/v4 v4.2.0 h1:N1wh+Goz61e6w66vo8vJkQt+uwZSoLz50kZPJWR8eic=
 github.com/go-playground/form/v4 v4.2.0/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=
 github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
@@ -204,7 +202,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
 github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
 github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
-github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
 github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
 github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
@@ -219,7 +216,6 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
 github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
 github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
 github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@@ -229,14 +225,12 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI
 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
 github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
 github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
 github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
 github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
 github.com/gophercloud/gophercloud v0.1.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
 github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
 github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
 github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
@@ -302,11 +296,9 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv
 github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
 github.com/little-cui/etcdadpt v0.3.2/go.mod h1:HnRRpIrVEVNWobkiCvG2EHLWKKZ+L047EcI29ma2zA4=
@@ -548,7 +540,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
 golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20220513210516-0976fa681c29 h1:w8s32wxx3sY+OjLlv9qltkLU5yvJzxjjgiHWLjdIcw4=
 golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -589,7 +580,6 @@ golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
 golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -597,7 +587,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -636,7 +625,6 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
 golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
 google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -660,7 +648,6 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG
 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
 google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
 google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
-google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I=
 google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
 google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
@@ -674,7 +661,6 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
 google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
 google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
-google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ=
 google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@@ -688,12 +674,10 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
 google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
 google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
diff --git a/contrib/registry/zookeeper/watcher.go b/contrib/registry/zookeeper/watcher.go
index 76f502fa..f2009675 100644
--- a/contrib/registry/zookeeper/watcher.go
+++ b/contrib/registry/zookeeper/watcher.go
@@ -10,7 +10,7 @@ import (
 	"github.com/go-zookeeper/zk"
 )
 
-var _ registry.Watcher = &watcher{}
+var _ registry.Watcher = (*watcher)(nil)
 
 var ErrWatcherStopped = errors.New("watcher stopped")
 
diff --git a/selector/p2c/p2c.go b/selector/p2c/p2c.go
index 6f8d5a3f..5e339b0c 100644
--- a/selector/p2c/p2c.go
+++ b/selector/p2c/p2c.go
@@ -17,7 +17,7 @@ const (
 	Name = "p2c"
 )
 
-var _ selector.Balancer = &Balancer{}
+var _ selector.Balancer = (*Balancer)(nil)
 
 // Option is random builder option.
 type Option func(o *options)
diff --git a/selector/random/random.go b/selector/random/random.go
index cf59534d..3af52d41 100644
--- a/selector/random/random.go
+++ b/selector/random/random.go
@@ -13,7 +13,7 @@ const (
 	Name = "random"
 )
 
-var _ selector.Balancer = &Balancer{} // Name is balancer name
+var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name
 
 // Option is random builder option.
 type Option func(o *options)
diff --git a/selector/wrr/wrr.go b/selector/wrr/wrr.go
index 0b95e04f..3d91d62e 100644
--- a/selector/wrr/wrr.go
+++ b/selector/wrr/wrr.go
@@ -13,7 +13,7 @@ const (
 	Name = "wrr"
 )
 
-var _ selector.Balancer = &Balancer{} // Name is balancer name
+var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name
 
 // Option is random builder option.
 type Option func(o *options)
diff --git a/transport/grpc/transport.go b/transport/grpc/transport.go
index a11a271a..866228d1 100644
--- a/transport/grpc/transport.go
+++ b/transport/grpc/transport.go
@@ -6,7 +6,7 @@ import (
 	"google.golang.org/grpc/metadata"
 )
 
-var _ transport.Transporter = &Transport{}
+var _ transport.Transporter = (*Transport)(nil)
 
 // Transport is a gRPC transport.
 type Transport struct {
diff --git a/transport/http/transport.go b/transport/http/transport.go
index c377b5ad..e7f53f6d 100644
--- a/transport/http/transport.go
+++ b/transport/http/transport.go
@@ -7,7 +7,7 @@ import (
 	"github.com/go-kratos/kratos/v2/transport"
 )
 
-var _ Transporter = &Transport{}
+var _ Transporter = (*Transport)(nil)
 
 // Transporter is http Transporter
 type Transporter interface {


Test patch:
diff --git a/config/reader_test.go b/config/reader_test.go
index f2ac1444..15f8f617 100644
--- a/config/reader_test.go
+++ b/config/reader_test.go
@@ -132,9 +132,6 @@ a:
 				t.Fatal(`vvv is not equal to 1`)
 			}
 
-			if err != nil {
-				t.Fatal(`err is not nil`)
-			}
 			vv, ok = r.Value("a.b.Y")
 			if !ok {
 				t.Fatal(`ok is false`)
@@ -147,9 +144,6 @@ a:
 				t.Fatal(`vvy is not equal to "lol"`)
 			}
 
-			if err != nil {
-				t.Fatal(`err is not nil`)
-			}
 			vv, ok = r.Value("a.b.z")
 			if !ok {
 				t.Fatal(`ok is false`)
diff --git a/contrib/config/polaris/config_test.go b/contrib/config/polaris/config_test.go
index bf8b6fd6..9559174f 100644
--- a/contrib/config/polaris/config_test.go
+++ b/contrib/config/polaris/config_test.go
@@ -26,13 +26,13 @@ var (
 func makeJSONRequest(uri string, data string, method string, headers map[string]string) ([]byte, error) {
 	client := http.Client{}
 	req, err := http.NewRequest(method, uri, strings.NewReader(data))
+	if err != nil {
+		return nil, err
+	}
 	req.Header.Add("Content-Type", "application/json")
 	for k, v := range headers {
 		req.Header.Add(k, v)
 	}
-	if err != nil {
-		return nil, err
-	}
 	res, err := client.Do(req)
 	if err != nil {
 		return nil, err
diff --git a/contrib/log/logrus/logrus_test.go b/contrib/log/logrus/logrus_test.go
index 3dcd6e64..50b7a99b 100644
--- a/contrib/log/logrus/logrus_test.go
+++ b/contrib/log/logrus/logrus_test.go
@@ -7,7 +7,6 @@ import (
 
 	"github.com/go-kratos/kratos/v2/log"
 	"github.com/sirupsen/logrus"
-	"github.com/stretchr/testify/assert"
 )
 
 func TestLoggerLog(t *testing.T) {
@@ -58,7 +57,9 @@ func TestLoggerLog(t *testing.T) {
 			wrapped := NewLogger(logger)
 			_ = wrapped.Log(test.logLevel, test.kvs...)
 
-			assert.True(t, strings.HasPrefix(output.String(), test.want))
+			if !strings.HasPrefix(output.String(), test.want) {
+				t.Errorf("TestName(%s): %s has not prefix %s", name, output.String(), test.want)
+			}
 		})
 	}
 }
diff --git a/contrib/registry/servicecomb/registry_test.go b/contrib/registry/servicecomb/registry_test.go
index d100c68a..85afe306 100644
--- a/contrib/registry/servicecomb/registry_test.go
+++ b/contrib/registry/servicecomb/registry_test.go
@@ -6,17 +6,14 @@ import (
 
 	pb "github.com/go-chassis/cari/discovery"
 	"github.com/go-chassis/sc-client"
-
 	"github.com/go-kratos/kratos/v2/registry"
 	"github.com/gofrs/uuid"
-	"github.com/stretchr/testify/assert"
 )
 
 var r *Registry
 
 func init() {
-	c := &mockClient{}
-	r = NewRegistry(c)
+	r = NewRegistry(&mockClient{})
 }
 
 type mockClient struct{}
@@ -28,7 +25,6 @@ func (receiver *mockClient) WatchMicroService(microServiceID string, callback fu
 //nolint
 func (receiver *mockClient) FindMicroServiceInstances(consumerID,
 	appID, microServiceName, versionRule string, opts ...sc.CallOption,
-
 ) ([]*pb.MicroServiceInstance, error) {
 	if microServiceName == "KratosServicecomb" {
 		return []*pb.MicroServiceInstance{{}}, nil
@@ -56,10 +52,11 @@ func (receiver *mockClient) GetMicroServiceID(appID, microServiceName, version,
 	return "", nil
 }
 
-// TestRegistry
 func TestRegistry(t *testing.T) {
 	instanceID, err := uuid.NewV4()
-	assert.NoError(t, err)
+	if err != nil {
+		t.Fatal(err)
+	}
 	svc := &registry.ServiceInstance{
 		Name:      "KratosServicecomb",
 		Version:   "0.0.1",
@@ -70,25 +67,34 @@ func TestRegistry(t *testing.T) {
 	ctx := context.TODO()
 	t.Run("Register test, expected: success.", func(t *testing.T) {
 		err = r.Register(ctx, svc)
-		assert.NoError(t, err)
+		if err != nil {
+			t.Error(err)
+		}
 	})
 	t.Run("GetService test, expected: success.", func(t *testing.T) {
 		var insts []*registry.ServiceInstance
 		insts, err = r.GetService(ctx, svc.Name)
-		assert.NoError(t, err)
-		assert.Greater(t, len(insts), 0)
+		if err != nil {
+			t.Fatal(err)
+		}
+		if len(insts) <= 0 {
+			t.Errorf("inst len less than 0")
+		}
 	})
 	t.Run("Deregister test, expected: success.", func(t *testing.T) {
 		svc.ID = instanceID.String()
 		err = r.Deregister(ctx, svc)
-		assert.NoError(t, err)
+		if err != nil {
+			t.Error(err)
+		}
 	})
 }
 
 func TestWatcher(t *testing.T) {
-	ctx := context.TODO()
 	instanceID1, err := uuid.NewV4()
-	assert.NoError(t, err)
+	if err != nil {
+		t.Fatal(err)
+	}
 	svc1 := &registry.ServiceInstance{
 		Name:      "WatcherTest",
 		Version:   "0.0.1",
@@ -96,33 +102,56 @@ func TestWatcher(t *testing.T) {
 		Endpoints: []string{"tcp://127.0.0.1:9000?isSecure=false"},
 		ID:        instanceID1.String(),
 	}
+	ctx := context.TODO()
 	err = r.Register(ctx, svc1)
-	assert.NoError(t, err)
+	if err != nil {
+		t.Fatal(err)
+	}
 	w, err := r.Watch(ctx, "WatcherTest")
-	assert.NoError(t, err)
-	assert.NotEmpty(t, w)
+	if err != nil {
+		t.Fatal(err)
+	}
+	if w == nil {
+		t.Fatal("w is nil")
+	}
 	sbWatcher := w.(*Watcher)
 	t.Run("Watch register event, expected: success", func(t *testing.T) {
 		go sbWatcher.Put(svc1)
 		var instances []*registry.ServiceInstance
 		instances, err = w.Next()
-		assert.NoError(t, err)
-		assert.NotEmpty(t, instances)
-		assert.Equal(t, instanceID1.String(), instances[0].ID)
+		if err != nil {
+			t.Fatal(err)
+		}
+		if len(instances) == 0 {
+			t.Errorf("instances is empty")
+		}
+		if instanceID1.String() != instances[0].ID {
+			t.Errorf("expected %v, got %v", instanceID1.String(), instances[0].ID)
+		}
 	})
 	t.Run("Watch deregister event, expected: success", func(t *testing.T) {
 		// Deregister instance1.
 		err = r.Deregister(ctx, svc1)
-		assert.NoError(t, err)
+		if err != nil {
+			t.Fatal(err)
+		}
 		go sbWatcher.Put(svc1)
 		var instances []*registry.ServiceInstance
 		instances, err = w.Next()
-		assert.NoError(t, err)
-		assert.NotEmpty(t, instances)
-		assert.Equal(t, instanceID1.String(), instances[0].ID)
+		if err != nil {
+			t.Fatal(err)
+		}
+		if len(instances) == 0 {
+			t.Errorf("instances is empty")
+		}
+		if instanceID1.String() != instances[0].ID {
+			t.Errorf("expected %v, got %v", instanceID1.String(), instances[0].ID)
+		}
 	})
 	t.Run("Stop test, expected: success", func(t *testing.T) {
 		err = w.Stop()
-		assert.NoError(t, err)
+		if err != nil {
+			t.Error(err)
+		}
 	})
 }
diff --git a/middleware/logging/logging_test.go b/middleware/logging/logging_test.go
index 7242f8e0..6ad1a02c 100644
--- a/middleware/logging/logging_test.go
+++ b/middleware/logging/logging_test.go
@@ -11,7 +11,7 @@ import (
 	"github.com/go-kratos/kratos/v2/transport"
 )
 
-var _ transport.Transporter = &Transport{}
+var _ transport.Transporter = (*Transport)(nil)
 
 type Transport struct {
 	kind      transport.Kind
diff --git a/middleware/selector/selector_test.go b/middleware/selector/selector_test.go
index 667d2755..f12943e4 100644
--- a/middleware/selector/selector_test.go
+++ b/middleware/selector/selector_test.go
@@ -10,7 +10,7 @@ import (
 	"github.com/go-kratos/kratos/v2/transport"
 )
 
-var _ transport.Transporter = &Transport{}
+var _ transport.Transporter = (*Transport)(nil)
 
 type Transport struct {
 	kind      transport.Kind
diff --git a/middleware/tracing/tracing_test.go b/middleware/tracing/tracing_test.go
index 8de2ceea..222a6acc 100644
--- a/middleware/tracing/tracing_test.go
+++ b/middleware/tracing/tracing_test.go
@@ -14,7 +14,7 @@ import (
 	"go.opentelemetry.io/otel/trace"
 )
 
-var _ transport.Transporter = &mockTransport{}
+var _ transport.Transporter = (*mockTransport)(nil)
 
 type headerCarrier http.Header
 
diff --git a/transport/transport_test.go b/transport/transport_test.go
index b83c8ee3..cba7f2ae 100644
--- a/transport/transport_test.go
+++ b/transport/transport_test.go
@@ -53,7 +53,7 @@ func TestServerTransport(t *testing.T) {
 		t.Errorf("expected:%v got:%v", true, ok)
 	}
 	if mtr == nil {
-		t.Errorf("expected:%v got:%v", nil, mtr)
+		t.Fatalf("expected:%v got:%v", nil, mtr)
 	}
 	if mtr.Kind().String() != KindGRPC.String() {
 		t.Errorf("expected:%v got:%v", KindGRPC.String(), mtr.Kind().String())