Repository: go-kratos/kratos
Pull request #2280 (2022-08-15 18:31:13)

build(deps): bump go.uber.org/zap from 1.21.0 to 1.22.0 in /contrib/log/zap
Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.21.0 to 1.22.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/uber-go/zap/releases">go.uber.org/zap's releases</a>.</em></p>
<blockquote>
<h2>v1.22.0</h2>
<p>Enhancements:</p>
<ul>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1071">#1071</a>[]: Add <code>zap.Objects</code> and <code>zap.ObjectValues</code> field constructors to log
arrays of objects. With these two constructors, you don't need to implement
<code>zapcore.ArrayMarshaler</code> for use with <code>zap.Array</code> if those objects implement
<code>zapcore.ObjectMarshaler</code>.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1079">#1079</a>[]: Add <code>SugaredLogger.WithOptions</code> to build a copy of an existing
<code>SugaredLogger</code> with the provided options applied.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1080">#1080</a>[]: Add <code>*ln</code> variants to <code>SugaredLogger</code> for each log level.
These functions provide a string joining behavior similar to <code>fmt.Println</code>.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1088">#1088</a>[]: Add <code>zap.WithFatalHook</code> option to control the behavior of the
logger for <code>Fatal</code>-level log entries. This defaults to exiting the program.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1108">#1108</a>[]: Add a <code>zap.Must</code> function that you can use with <code>NewProduction</code> or
<code>NewDevelopment</code> to panic if the system was unable to build the logger.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1118">#1118</a>[]: Add a <code>Logger.Log</code> method that allows specifying the log level for
a statement dynamically.</li>
</ul>
<p>Thanks to <a href="https://github.com/cardil"><code>@​cardil</code></a>, <a href="https://github.com/craigpastro"><code>@​craigpastro</code></a>, <a href="https://github.com/sashamelentyev"><code>@​sashamelentyev</code></a>, <a href="https://github.com/shota3506"><code>@​shota3506</code></a>, and <a href="https://github.com/zhupeijun"><code>@​zhupeijun</code></a>
for their contributions to this release.</p>
<p><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1071">#1071</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1071">uber-go/zap#1071</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1079">#1079</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1079">uber-go/zap#1079</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1080">#1080</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1080">uber-go/zap#1080</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1088">#1088</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1088">uber-go/zap#1088</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1108">#1108</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1108">uber-go/zap#1108</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1118">#1118</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1118">uber-go/zap#1118</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/uber-go/zap/blob/master/CHANGELOG.md">go.uber.org/zap's changelog</a>.</em></p>
<blockquote>
<h2>1.22.0 (8 Aug 2022)</h2>
<p>Enhancements:</p>
<ul>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1071">#1071</a>[]: Add <code>zap.Objects</code> and <code>zap.ObjectValues</code> field constructors to log
arrays of objects. With these two constructors, you don't need to implement
<code>zapcore.ArrayMarshaler</code> for use with <code>zap.Array</code> if those objects implement
<code>zapcore.ObjectMarshaler</code>.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1079">#1079</a>[]: Add <code>SugaredLogger.WithOptions</code> to build a copy of an existing
<code>SugaredLogger</code> with the provided options applied.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1080">#1080</a>[]: Add <code>*ln</code> variants to <code>SugaredLogger</code> for each log level.
These functions provide a string joining behavior similar to <code>fmt.Println</code>.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1088">#1088</a>[]: Add <code>zap.WithFatalHook</code> option to control the behavior of the
logger for <code>Fatal</code>-level log entries. This defaults to exiting the program.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1108">#1108</a>[]: Add a <code>zap.Must</code> function that you can use with <code>NewProduction</code> or
<code>NewDevelopment</code> to panic if the system was unable to build the logger.</li>
<li><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1118">#1118</a>[]: Add a <code>Logger.Log</code> method that allows specifying the log level for
a statement dynamically.</li>
</ul>
<p>Thanks to <a href="https://github.com/cardil"><code>@​cardil</code></a>, <a href="https://github.com/craigpastro"><code>@​craigpastro</code></a>, <a href="https://github.com/sashamelentyev"><code>@​sashamelentyev</code></a>, <a href="https://github.com/shota3506"><code>@​shota3506</code></a>, and <a href="https://github.com/zhupeijun"><code>@​zhupeijun</code></a>
for their contributions to this release.</p>
<p><a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1071">#1071</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1071">uber-go/zap#1071</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1079">#1079</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1079">uber-go/zap#1079</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1080">#1080</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1080">uber-go/zap#1080</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1088">#1088</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1088">uber-go/zap#1088</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1108">#1108</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1108">uber-go/zap#1108</a>
<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1118">#1118</a>: <a href="https://github-redirect.dependabot.com/uber-go/zap/pull/1118">uber-go/zap#1118</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/uber-go/zap/commit/4b03bc56483d64b4714462e513099701e62b43d3"><code>4b03bc5</code></a> Prepare release v1.22.0 (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1145">#1145</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/ee349f9e2995499f66628dc573382939b6941b09"><code>ee349f9</code></a> CI: Lint against 1.19 (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1141">#1141</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/7ee98d28331c26c2be992e3e6e6d199337204bb0"><code>7ee98d2</code></a> ci: add go1.19 (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1140">#1140</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/ca232b973d5025a9fab2e2ea460a00c605161418"><code>ca232b9</code></a> zapcore/BufferedWriteSyncer: More docs (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1139">#1139</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/4cfaabdda0c24da1d6c7545be8c1ebfcd57e6ccd"><code>4cfaabd</code></a> chore(ztest/timeout): capture original scale after err handling (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1138">#1138</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/11a750e83adc2e854e6f2c262bab2bb409e88464"><code>11a750e</code></a> chore(internal/exit): remove deprecated function (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1137">#1137</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/d6ce3b9b283401bc6cf975de6ac3e5ed5aec5341"><code>d6ce3b9</code></a> chore: remove redundant arg from logln (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1136">#1136</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/e3a10fc58d1de17b83f4a27140758d941aa4d420"><code>e3a10fc</code></a> chore: use errors.New instead of format function without args for error (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1134">#1134</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/2cfc92c94b14298b9ff814f7fbfdda850046e7b3"><code>2cfc92c</code></a> lint CONTRIBUTING.md and README.md (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1123">#1123</a>)</li>
<li><a href="https://github.com/uber-go/zap/commit/56b4e2bfacf31ffeaa2d3ec7bee4fdb8485f81cc"><code>56b4e2b</code></a> Remove the redundant return value of the <code>open</code> function (<a href="https://github-redirect.dependabot.com/uber-go/zap/issues/1120">#1120</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/uber-go/zap/compare/v1.21.0...v1.22.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=go.uber.org/zap&package-manager=go_modules&previous-version=1.21.0&new-version=1.22.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov-commenter: # [Codecov](https://codecov.io/gh/go-kratos/kratos/pull/2280?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) Report
> Merging [#2280](https://codecov.io/gh/go-kratos/kratos/pull/2280?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (fa4374b) into [main](https://codecov.io/gh/go-kratos/kratos/commit/3f31b4d734536a876c5b0e09b029d6074c105ca6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (3f31b4d) will **increase** coverage by `0.36%`.
> The diff coverage is `n/a`.

> :exclamation: Current head fa4374b differs from pull request most recent head 28811a0. Consider uploading reports for the commit 28811a0 to get more accurate results

```diff
@@            Coverage Diff             @@
##             main    #2280      +/-   ##
==========================================
+ Coverage   85.17%   85.53%   +0.36%     
==========================================
  Files          88       87       -1     
  Lines        3783     3796      +13     
==========================================
+ Hits         3222     3247      +25     
+ Misses        389      381       -8     
+ Partials      172      168       -4     
```


| [Impacted Files](https://codecov.io/gh/go-kratos/kratos/pull/2280?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) | Coverage Δ | |
|---|---|---|
| [transport/http/client.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2h0dHAvY2xpZW50Lmdv) | `85.16% <0.00%> (-0.32%)` | :arrow_down: |
| [selector/global.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3IvZ2xvYmFsLmdv) | | |
| [transport/grpc/balancer.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvYmFsYW5jZXIuZ28=) | `92.00% <0.00%> (+0.69%)` | :arrow_up: |
| [log/global.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-bG9nL2dsb2JhbC5nbw==) | `77.55% <0.00%> (+0.95%)` | :arrow_up: |
| [selector/default\_selector.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3IvZGVmYXVsdF9zZWxlY3Rvci5nbw==) | `80.95% <0.00%> (+1.46%)` | :arrow_up: |
| [transport/grpc/client.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-dHJhbnNwb3J0L2dycGMvY2xpZW50Lmdv) | `93.10% <0.00%> (+2.29%)` | :arrow_up: |
| [selector/p2c/p2c.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3IvcDJjL3AyYy5nbw==) | `100.00% <0.00%> (+5.40%)` | :arrow_up: |
| [selector/wrr/wrr.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3Ivd3JyL3dyci5nbw==) | `100.00% <0.00%> (+6.66%)` | :arrow_up: |
| [selector/random/random.go](https://codecov.io/gh/go-kratos/kratos/pull/2280/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos#diff-c2VsZWN0b3IvcmFuZG9tL3JhbmRvbS5nbw==) | `100.00% <0.00%> (+11.11%)` | :arrow_up: |

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/README.md b/README.md
index 0508d5c6..f4023812 100644
--- a/README.md
+++ b/README.md
@@ -17,21 +17,21 @@
 
 ## About Kratos
   
-> The name is inspired by the game God of War which is based on Greek myths, tells the adventures of Kratos who became a god of war from a mortal and launched a god-killing slaughter.
+> The name is inspired by the Greek-mythology-based game "God of War". It tells the adventures of Kratos becoming a god of war from a mortal and launching a god-killing slaughter.
 
 Kratos is a microservice-oriented governance framework implemented by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch, such as:
 
 - The [communication protocol](https://go-kratos.dev/en/docs/component/api) is based on the HTTP/gRPC through the definition of Protobuf.
-- Abstract [transport](https://go-kratos.dev/en/docs/component/transport/overview) layer are support: [HTTP](https://go-kratos.dev/en/docs/component/transport/http) / [gRPC](https://go-kratos.dev/en/docs/component/transport/grpc).
-- Powerful [middleware](https://go-kratos.dev/en/docs/component/middleware/overview) design, support: [Tracing (OpenTelemetry)](https://go-kratos.dev/en/docs/component/middleware/tracing)、[Metrics (Prometheus is default)](https://go-kratos.dev/en/docs/component/middleware/metrics)、[Recovery](https://go-kratos.dev/en/docs/component/middleware/recovery) and more.
+- Abstract [transport](https://go-kratos.dev/en/docs/component/transport/overview) layer support: [HTTP](https://go-kratos.dev/en/docs/component/transport/http) / [gRPC](https://go-kratos.dev/en/docs/component/transport/grpc).
+- Powerful [middleware](https://go-kratos.dev/en/docs/component/middleware/overview) design, support: [Tracing (OpenTelemetry)](https://go-kratos.dev/en/docs/component/middleware/tracing), [Metrics (Prometheus is default)](https://go-kratos.dev/en/docs/component/middleware/metrics), [Recovery](https://go-kratos.dev/en/docs/component/middleware/recovery) and more.
 - [Registry](https://go-kratos.dev/en/docs/component/registry) interface able to be connected with various other centralized registries through plug-ins.
-- The [standard log interfaces](https://go-kratos.dev/en/docs/component/log) ease the integration of the third-party log libs and logs are collected through the *Fluentd*.
-- The selection of the content [encoding](https://go-kratos.dev/en/docs/component/encoding) is automatically supported by Accept and Content-Type.
+- The [standard log interfaces](https://go-kratos.dev/en/docs/component/log) ease the integration of the third-party log libs with logs collected through the *Fluentd*.
+- Automatically support the selection of the content [encoding](https://go-kratos.dev/en/docs/component/encoding) with Accept and Content-Type.
 - Multiple data sources are supported for [configurations](https://go-kratos.dev/en/docs/component/config) and dynamic configurations (use atomic operations).
-- In the protocol of HTTP/gRPC, use uniform [metadata](https://go-kratos.dev/en/docs/component/metadata) transfer method.
+- In the protocol of HTTP/gRPC, use the uniform [metadata](https://go-kratos.dev/en/docs/component/metadata) transfer method.
 - You can define [errors](https://go-kratos.dev/en/docs/component/errors/) in protos and generate enums with protoc-gen-go.
-- You can define [verification rules](https://go-kratos.dev/en/docs/component/middleware/validate) in Protobuf which is supported by HTTP/gRPC service.
-- [Swagger API](https://go-kratos.dev/en/docs/guide/openapi) generated Automatically and embed Swagger UI endpoint can be started by adding [Swagger plugin](https://github.com/go-kratos/swagger-api).
+- You can define [verification rules](https://go-kratos.dev/en/docs/component/middleware/validate) in Protobuf supported by the HTTP/gRPC service.
+- [Swagger API](https://go-kratos.dev/en/docs/guide/openapi) is generated Automatically and embed Swagger UI endpoint can be started by adding [Swagger plugin](https://github.com/go-kratos/swagger-api).
 
 Kratos is accessible, powerful, and provides tools required for large, robust applications.
 
@@ -39,7 +39,7 @@ Kratos is accessible, powerful, and provides tools required for large, robust ap
 
 Kratos has the most extensive and thorough [documentation](https://go-kratos.dev/en/docs/getting-started/start) and [example](https://github.com/go-kratos/examples) library of all modern web application frameworks, making it a breeze to get started with the framework.
 
-We also provide a [modern template](https://github.com/go-kratos/kratos-layout), This template should help reduce the work required to setup up a modern project.
+We also provide a [modern template](https://github.com/go-kratos/kratos-layout). This template should help reduce the work required to setup up modern projects.
 
 ### Goals
 
@@ -47,13 +47,13 @@ Kratos boosts your productivity. With the integration of excellent resources and
 
 ### Principles
 
-* **Simple**: Appropriate design, plain and easy code.
+* **Simple**: Appropriate design with plain and easy code.
 * **General**: Cover the various utilities for business development.
 * **Highly efficient**: Speeding up the efficiency of businesses upgrading.
-* **Stable**: The base libs validated in the production environment which have the characters of the high testability, high coverage as well as high security and reliability.
+* **Stable**: The base libs validated in the production environment have the characteristics of high testability, high coverage as well as high security and reliability.
 * **Robust**: Eliminating misusing through high quality of the base libs.
 * **High-performance**: Optimal performance excluding the optimization of hacking in case of *unsafe*. 
-* **Expandability**: Properly designed interfaces, you can expand utilities such as base libs to meet your further requirements.
+* **Expandability**: Properly designed interfaces where you can expand utilities such as base libs to meet your further requirements.
 * **Fault-tolerance**: Designed against failure, enhance the understanding and exercising of SRE within Kratos to achieve more robustness.
 * **Toolchain**: Includes an extensive toolchain, such as the code generation of cache, the lint tool, and so forth.
 
diff --git a/app.go b/app.go
index 0a5afabc..e3d81ffb 100644
--- a/app.go
+++ b/app.go
@@ -101,7 +101,7 @@ func (a *App) Run() error {
 		})
 		wg.Add(1)
 		eg.Go(func() error {
-			wg.Done()
+			wg.Done() // here is to ensure server start has begun running before register, so defer is not needed
 			return srv.Start(NewContext(a.opts.ctx, a))
 		})
 	}
diff --git a/contrib/log/zap/go.mod b/contrib/log/zap/go.mod
index ecb315e1..192127ee 100644
--- a/contrib/log/zap/go.mod
+++ b/contrib/log/zap/go.mod
@@ -4,7 +4,7 @@ go 1.16
 
 require (
 	github.com/go-kratos/kratos/v2 v2.5.0
-	go.uber.org/zap v1.21.0
+	go.uber.org/zap v1.22.0
 )
 
 replace github.com/go-kratos/kratos/v2 => ../../../
diff --git a/contrib/log/zap/go.sum b/contrib/log/zap/go.sum
index d90e2679..1a82a384 100644
--- a/contrib/log/zap/go.sum
+++ b/contrib/log/zap/go.sum
@@ -90,8 +90,8 @@ go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI=
 go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
 go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
 go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
-go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
-go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
+go.uber.org/zap v1.22.0 h1:Zcye5DUgBloQ9BaT4qc9BnjOFog5TvBSAGkJ3Nf70c0=
+go.uber.org/zap v1.22.0/go.mod h1:H4siCOZOrAolnUPJEkfaSjDqyP+BDS0DdDWzwcgt3+U=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -179,12 +179,10 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/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=
-gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
 gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA=
 gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/encoding/form/proto_decode.go b/encoding/form/proto_decode.go
index 9e31e3ba..2856bef5 100644
--- a/encoding/form/proto_decode.go
+++ b/encoding/form/proto_decode.go
@@ -12,11 +12,11 @@ import (
 	"google.golang.org/protobuf/encoding/protojson"
 	"google.golang.org/protobuf/types/known/structpb"
 
-	"google.golang.org/genproto/protobuf/field_mask"
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/reflect/protoregistry"
 	"google.golang.org/protobuf/types/known/durationpb"
+	"google.golang.org/protobuf/types/known/fieldmaskpb"
 	"google.golang.org/protobuf/types/known/timestamppb"
 	"google.golang.org/protobuf/types/known/wrapperspb"
 )
@@ -289,7 +289,7 @@ func parseMessage(md protoreflect.MessageDescriptor, value string) (protoreflect
 		}
 		msg = wrapperspb.Bytes(v)
 	case "google.protobuf.FieldMask":
-		fm := &field_mask.FieldMask{}
+		fm := &fieldmaskpb.FieldMask{}
 		for _, fv := range strings.Split(value, ",") {
 			fm.Paths = append(fm.Paths, jsonSnakeCase(fv))
 		}
diff --git a/internal/endpoint/endpoint.go b/internal/endpoint/endpoint.go
index e4c9ef96..160b694f 100644
--- a/internal/endpoint/endpoint.go
+++ b/internal/endpoint/endpoint.go
@@ -2,7 +2,6 @@ package endpoint
 
 import (
 	"net/url"
-	"strconv"
 )
 
 // NewEndpoint new an Endpoint URL.
@@ -18,10 +17,6 @@ func ParseEndpoint(endpoints []string, scheme string) (string, error) {
 			return "", err
 		}
 
-		// TODO: Compatibility processing
-		// Function is to convert grpc:/127.0.0.1/?isSecure=true into grpcs:/127.0.0.1/
-		// It will be deleted in about a month
-		u = legacyURLToNew(u)
 		if u.Scheme == scheme {
 			return u.Host, nil
 		}
@@ -29,27 +24,6 @@ func ParseEndpoint(endpoints []string, scheme string) (string, error) {
 	return "", nil
 }
 
-func legacyURLToNew(u *url.URL) *url.URL {
-	if u.Scheme == "https" || u.Scheme == "grpcs" {
-		return u
-	}
-	if IsSecure(u) {
-		return &url.URL{Scheme: u.Scheme + "s", Host: u.Host}
-	}
-	return u
-}
-
-// IsSecure parses isSecure for Endpoint URL.
-// Note: It will be deleted after some time,
-// unified use grpcs://127.0.0.1:8080 instead of grpc://127.0.0.1:8080?isSecure=true
-func IsSecure(u *url.URL) bool {
-	ok, err := strconv.ParseBool(u.Query().Get("isSecure"))
-	if err != nil {
-		return false
-	}
-	return ok
-}
-
 // Scheme is the scheme of endpoint url.
 // examples: scheme="http",isSecure=true get "https"
 func Scheme(scheme string, isSecure bool) string {
diff --git a/metadata/metadata.go b/metadata/metadata.go
index be180625..3dabdbae 100644
--- a/metadata/metadata.go
+++ b/metadata/metadata.go
@@ -46,7 +46,7 @@ func (m Metadata) Range(f func(k, v string) bool) {
 
 // Clone returns a deep copy of Metadata
 func (m Metadata) Clone() Metadata {
-	md := Metadata{}
+	md := make(Metadata, len(m))
 	for k, v := range m {
 		md[k] = v
 	}
diff --git a/transport/http/context.go b/transport/http/context.go
index 347d93ff..f65e03fb 100644
--- a/transport/http/context.go
+++ b/transport/http/context.go
@@ -46,7 +46,7 @@ type responseWriter struct {
 	w    http.ResponseWriter
 }
 
-func (w *responseWriter) rest(res http.ResponseWriter) {
+func (w *responseWriter) reset(res http.ResponseWriter) {
 	w.w = res
 	w.code = http.StatusOK
 }
@@ -151,7 +151,7 @@ func (c *wrapper) Stream(code int, contentType string, rd io.Reader) error {
 }
 
 func (c *wrapper) Reset(res http.ResponseWriter, req *http.Request) {
-	c.w.rest(res)
+	c.w.reset(res)
 	c.res = res
 	c.req = req
 }


Test patch:
diff --git a/internal/endpoint/endpoint_test.go b/internal/endpoint/endpoint_test.go
index e8870c80..c02878fd 100644
--- a/internal/endpoint/endpoint_test.go
+++ b/internal/endpoint/endpoint_test.go
@@ -6,41 +6,6 @@ import (
 	"testing"
 )
 
-func TestEndPoint(t *testing.T) {
-	type args struct {
-		url *url.URL
-	}
-	tests := []struct {
-		name string
-		args args
-		want bool
-	}{
-		// TODO: Add test cases.
-		{
-			name: "grpc://127.0.0.1?isSecure=false",
-			args: args{&url.URL{Scheme: "grpc", Host: "127.0.0.1", RawQuery: "isSecure=false"}},
-			want: false,
-		},
-		{
-			name: "grpc://127.0.0.1?isSecure=true",
-			args: args{&url.URL{Scheme: "grpc", Host: "127.0.0.1", RawQuery: "isSecure=true"}},
-			want: true,
-		},
-		{
-			name: "grpc://127.0.0.1",
-			args: args{&url.URL{Scheme: "grpc", Host: "127.0.0.1"}},
-			want: false,
-		},
-	}
-	for _, tt := range tests {
-		t.Run(tt.name, func(t *testing.T) {
-			if got := IsSecure(tt.args.url); !reflect.DeepEqual(got, tt.want) {
-				t.Errorf("GetQuery() = %v, want %v", got, tt.want)
-			}
-		})
-	}
-}
-
 func TestNewEndpoint(t *testing.T) {
 	type args struct {
 		scheme string
@@ -111,20 +76,6 @@ func TestParseEndpoint(t *testing.T) {
 			want:    "",
 			wantErr: false,
 		},
-
-		// Legacy
-		{
-			name:    "google",
-			args:    args{endpoints: []string{"grpc://www.google.com/?isSecure=true"}, scheme: "grpcs"},
-			want:    "www.google.com",
-			wantErr: false,
-		},
-		{
-			name:    "baidu",
-			args:    args{endpoints: []string{"http://www.baidu.com/?isSecure=true"}, scheme: "https"},
-			want:    "www.baidu.com",
-			wantErr: false,
-		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
@@ -140,56 +91,6 @@ func TestParseEndpoint(t *testing.T) {
 	}
 }
 
-func TestIsSecure(t *testing.T) {
-	tests := []struct {
-		url  *url.URL
-		want bool
-	}{
-		{
-			url:  &url.URL{Scheme: "http", Host: "127.0.0.1"},
-			want: false,
-		},
-		{
-			url:  &url.URL{Scheme: "http", Host: "127.0.0.1", RawQuery: "isSecure=false"},
-			want: false,
-		},
-		{
-			url:  &url.URL{Scheme: "grpc", Host: "127.0.0.1", RawQuery: "isSecure=true"},
-			want: true,
-		},
-	}
-	for _, tt := range tests {
-		if got := IsSecure(tt.url); got != tt.want {
-			t.Errorf("IsSecure() = %v, want %v", got, tt.want)
-		}
-	}
-}
-
-func TestLegacyURLToNew(t *testing.T) {
-	tests := []struct {
-		url  *url.URL
-		want *url.URL
-	}{
-		{
-			url:  &url.URL{Scheme: "http", Host: "www.google.com", RawQuery: "isSecure=true"},
-			want: &url.URL{Scheme: "https", Host: "www.google.com"},
-		},
-		{
-			url:  &url.URL{Scheme: "https", Host: "www.google.com", RawQuery: "isSecure=true"},
-			want: &url.URL{Scheme: "https", Host: "www.google.com", RawQuery: "isSecure=true"},
-		},
-		{
-			url:  &url.URL{Scheme: "http", Host: "go-kratos.dev", RawQuery: "isSecure=false"},
-			want: &url.URL{Scheme: "http", Host: "go-kratos.dev", RawQuery: "isSecure=false"},
-		},
-	}
-	for _, tt := range tests {
-		if got := legacyURLToNew(tt.url); !reflect.DeepEqual(got, tt.want) {
-			t.Errorf("legacyURLToNew() = %v, want %v", got, tt.want)
-		}
-	}
-}
-
 func TestSchema(t *testing.T) {
 	tests := []struct {
 		schema string