Repository: go-kratos/kratos
Pull request #2751 (2023-03-20 19:00:52)

build(deps): bump google.golang.org/protobuf from 1.28.1 to 1.30.0 in /contrib/log/aliyun
Bumps [google.golang.org/protobuf](https://github.com/protocolbuffers/protobuf-go) from 1.28.1 to 1.30.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/protocolbuffers/protobuf-go/releases">google.golang.org/protobuf's releases</a>.</em></p>
<blockquote>
<h2>v1.30.0</h2>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.30.0-notable-changes">Notable changes</a></li>
</ul>
<p><strong>Announcement</strong>
In the previous two releases, v1.29.0 and v1.29.1, we associated the tags with the wrong commits and thus the tags do not reference any commit in this repository. This tag, v1.30.0, refers to an existing commit again. Sorry for the inconvenience.</p>
<h2>Notable changes <!-- raw HTML omitted --><!-- raw HTML omitted --></h2>
<p><strong>New Features</strong></p>
<ul>
<li><a href="https://go.dev/cl/449576">CL/449576</a>: protoadapt: helper functions to convert v1 or v2 message to either v1 or v2 message.</li>
</ul>
<h2>v1.29.1</h2>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.29.1-notable-changes">Notable changes</a></li>
</ul>
<h2>Notable changes <!-- raw HTML omitted --><!-- raw HTML omitted --></h2>
<p><strong>Bug fixes</strong></p>
<ul>
<li><a href="https://go.dev/cl/475995">CL/475995</a>: internal/encoding/text: fix parsing of incomplete numbers</li>
</ul>
<h2>v1.29.0</h2>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.29-overview">Overview</a></li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/blob/HEAD/#v1.29-notable-changes">Notable changes</a></li>
</ul>
<h2>Overview <!-- raw HTML omitted --><!-- raw HTML omitted --></h2>
<p>This version introduces a new package <code>protodelim</code> to marshal and unmarshal size-delimited messages.
It also brings the implementation up to date with the latest protobuf features.</p>
<h2>Notable changes <!-- raw HTML omitted --><!-- raw HTML omitted --></h2>
<p><strong>New Features</strong></p>
<ul>
<li><a href="https://go.dev/cl/419254">CL/419254</a>: encoding: add protodelim package</li>
<li><a href="https://go.dev/cl/450775">CL/450775</a>: reflect/protoreflect: add Value.Equal method</li>
<li><a href="https://go.dev/cl/462315">CL/462315</a>: cmd/protoc-gen-go: make deprecated messages more descriptive</li>
<li><a href="https://go.dev/cl/473015">CL/473015</a>: encoding/prototext: allow whitespace and comments between minus sign and number in negative numeric literal</li>
</ul>
<p><strong>Alignment with protobuf</strong></p>
<ul>
<li><a href="https://go.dev/cl/426054">CL/426054</a>: types/descriptorpb: update *.pb.go to use latest protoc release, 21.5</li>
<li><a href="https://go.dev/cl/425554">CL/425554</a>: encoding/protojson: fix parsing of google.protobuf.Timestamp</li>
<li><a href="https://go.dev/cl/461238">CL/461238</a>: protobuf: remove the check for reserved field numbers</li>
<li><a href="https://go.dev/cl/469255">CL/469255</a>: types/descriptorpb: regenerate using latest protobuf v22.0 release</li>
<li><a href="https://go.dev/cl/472696">CL/472696</a>: cmd/protoc-gen-go: support protobuf retention feature</li>
</ul>
<p><strong>Documentation improvements:</strong></p>
<ul>
<li><a href="https://go.dev/cl/464275">CL/464275</a>: proto: document Equal behavior of invalid messages</li>
<li><a href="https://go.dev/cl/466375">CL/466375</a>: all: update links to Protocol Buffer documentation</li>
</ul>
<p><strong>Minor performance improvements</strong></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/f221882bfb484564f1714ae05f197dea2c76898d"><code>f221882</code></a> all: release v1.30.0</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/e344383da66ac9cf11000f824674793a77fc7d7e"><code>e344383</code></a> protoadapt: helper functions to convert v1 or v2 message to either v1 or v2 m...</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/32efccd1582255f0ef48bcc3942484e81985c76b"><code>32efccd</code></a> all: start v1.29.1-devel</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/771d8c7a1eefbd21bf7db08ec6967fed9ff9d704"><code>771d8c7</code></a> all: release v1.29.1</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/edaf511a7a37a90db2727b600d699e1e8d2840b4"><code>edaf511</code></a> internal/encoding/text: fix parsing of incomplete numbers</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/fe5bc5404151983756ef8980016a7d59bd63bb7e"><code>fe5bc54</code></a> all: start v1.29.0-devel</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/d3c9826520c7d6061812d1d94ad81f871792ea8c"><code>d3c9826</code></a> all: release v1.29.0</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/eba8b0975f4efc219baabc1e0e13df28a6e1ad28"><code>eba8b09</code></a> cmd/protoc-gen-go: support protobuf retention feature</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/fcf5f6cb72978812ac36085183b5c52701c069cb"><code>fcf5f6c</code></a> encoding/prototext: allow whitespace and comments between minus sign and numb...</li>
<li><a href="https://github.com/protocolbuffers/protobuf-go/commit/bc1253ad37431ee26876db47cd8207cdec81993c"><code>bc1253a</code></a> types/descriptorpb: regenerate using latest protobuf v22.0 release</li>
<li>Additional commits viewable in <a href="https://github.com/protocolbuffers/protobuf-go/compare/v1.28.1...v1.30.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=google.golang.org/protobuf&package-manager=go_modules&previous-version=1.28.1&new-version=1.30.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>

haiyux: @dependabot rebase
codecov-commenter: ## [Codecov](https://codecov.io/gh/go-kratos/kratos/pull/2751?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) Report
> Merging [#2751](https://codecov.io/gh/go-kratos/kratos/pull/2751?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (957a98b) into [main](https://codecov.io/gh/go-kratos/kratos/commit/f47a238478e1e8fb0172c8eb130523cdb37eb2e3?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=go-kratos) (f47a238) will **not change** coverage.
> The diff coverage is `n/a`.

> :exclamation: Current head 957a98b differs from pull request most recent head 4352e39. Consider uploading reports for the commit 4352e39 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    #2751   +/-   ##
=======================================
  Coverage   84.78%   84.78%           
=======================================
  Files          88       88           
  Lines        3891     3891           
=======================================
  Hits         3299     3299           
  Misses        418      418           
  Partials      174      174           
```



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/.golangci.yml b/.golangci.yml
index 06ee200c..1408787e 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -68,4 +68,4 @@ linters-settings:
     # recommend 10-20
     min-complexity: 50
   goimports:
-    local-prefixes: github.com/go-kratos/kratos # Put imports beginning with prefix after 3rd-party packages
+    local-prefixes: github.com/go-kratos # Put imports beginning with prefix after 3rd-party packages
diff --git a/cmd/kratos/internal/base/path.go b/cmd/kratos/internal/base/path.go
index 7456ba67..d24647fd 100644
--- a/cmd/kratos/internal/base/path.go
+++ b/cmd/kratos/internal/base/path.go
@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"log"
 	"os"
-	"path"
 	"path/filepath"
 	"strings"
 
@@ -17,7 +16,7 @@ func kratosHome() string {
 	if err != nil {
 		log.Fatal(err)
 	}
-	home := path.Join(dir, ".kratos")
+	home := filepath.Join(dir, ".kratos")
 	if _, err := os.Stat(home); os.IsNotExist(err) {
 		if err := os.MkdirAll(home, 0o700); err != nil {
 			log.Fatal(err)
@@ -27,7 +26,7 @@ func kratosHome() string {
 }
 
 func kratosHomeWithDir(dir string) string {
-	home := path.Join(kratosHome(), dir)
+	home := filepath.Join(kratosHome(), dir)
 	if _, err := os.Stat(home); os.IsNotExist(err) {
 		if err := os.MkdirAll(home, 0o700); err != nil {
 			log.Fatal(err)
@@ -75,8 +74,8 @@ func copyDir(src, dst string, replaces, ignores []string) error {
 		if hasSets(fd.Name(), ignores) {
 			continue
 		}
-		srcfp := path.Join(src, fd.Name())
-		dstfp := path.Join(dst, fd.Name())
+		srcfp := filepath.Join(src, fd.Name())
+		dstfp := filepath.Join(dst, fd.Name())
 		var e error
 		if fd.IsDir() {
 			e = copyDir(srcfp, dstfp, replaces, ignores)
diff --git a/cmd/kratos/internal/base/repo.go b/cmd/kratos/internal/base/repo.go
index 4ad241c8..fe1ba18e 100644
--- a/cmd/kratos/internal/base/repo.go
+++ b/cmd/kratos/internal/base/repo.go
@@ -7,6 +7,7 @@ import (
 	"os"
 	"os/exec"
 	"path"
+	"path/filepath"
 	"strings"
 )
 
@@ -104,7 +105,7 @@ func (r *Repo) CopyTo(ctx context.Context, to string, modPath string, ignores []
 	if err := r.Clone(ctx); err != nil {
 		return err
 	}
-	mod, err := ModulePath(path.Join(r.Path(), "go.mod"))
+	mod, err := ModulePath(filepath.Join(r.Path(), "go.mod"))
 	if err != nil {
 		return err
 	}
@@ -116,7 +117,7 @@ func (r *Repo) CopyToV2(ctx context.Context, to string, modPath string, ignores,
 	if err := r.Clone(ctx); err != nil {
 		return err
 	}
-	mod, err := ModulePath(path.Join(r.Path(), "go.mod"))
+	mod, err := ModulePath(filepath.Join(r.Path(), "go.mod"))
 	if err != nil {
 		return err
 	}
diff --git a/cmd/kratos/internal/project/add.go b/cmd/kratos/internal/project/add.go
index 72a89f29..df5eff11 100644
--- a/cmd/kratos/internal/project/add.go
+++ b/cmd/kratos/internal/project/add.go
@@ -4,7 +4,7 @@ import (
 	"context"
 	"fmt"
 	"os"
-	"path"
+	"path/filepath"
 
 	"github.com/AlecAivazis/survey/v2"
 	"github.com/fatih/color"
@@ -17,7 +17,7 @@ var repoAddIgnores = []string{
 }
 
 func (p *Project) Add(ctx context.Context, dir string, layout string, branch string, mod string) error {
-	to := path.Join(dir, p.Name)
+	to := filepath.Join(dir, p.Name)
 
 	if _, err := os.Stat(to); !os.IsNotExist(err) {
 		fmt.Printf("🚫 %s already exists\n", p.Name)
@@ -40,13 +40,13 @@ func (p *Project) Add(ctx context.Context, dir string, layout string, branch str
 
 	repo := base.NewRepo(layout, branch)
 
-	if err := repo.CopyToV2(ctx, to, path.Join(mod, p.Path), repoAddIgnores, []string{path.Join(p.Path, "api"), "api"}); err != nil {
+	if err := repo.CopyToV2(ctx, to, filepath.Join(mod, p.Path), repoAddIgnores, []string{filepath.Join(p.Path, "api"), "api"}); err != nil {
 		return err
 	}
 
 	e := os.Rename(
-		path.Join(to, "cmd", "server"),
-		path.Join(to, "cmd", p.Name),
+		filepath.Join(to, "cmd", "server"),
+		filepath.Join(to, "cmd", p.Name),
 	)
 	if e != nil {
 		return e
diff --git a/cmd/kratos/internal/project/new.go b/cmd/kratos/internal/project/new.go
index c084e7f0..73c01986 100644
--- a/cmd/kratos/internal/project/new.go
+++ b/cmd/kratos/internal/project/new.go
@@ -4,7 +4,7 @@ import (
 	"context"
 	"fmt"
 	"os"
-	"path"
+	"path/filepath"
 
 	"github.com/AlecAivazis/survey/v2"
 	"github.com/fatih/color"
@@ -20,7 +20,7 @@ type Project struct {
 
 // New new a project from remote repo.
 func (p *Project) New(ctx context.Context, dir string, layout string, branch string) error {
-	to := path.Join(dir, p.Name)
+	to := filepath.Join(dir, p.Name)
 	if _, err := os.Stat(to); !os.IsNotExist(err) {
 		fmt.Printf("🚫 %s already exists\n", p.Name)
 		prompt := &survey.Confirm{
@@ -43,8 +43,8 @@ func (p *Project) New(ctx context.Context, dir string, layout string, branch str
 		return err
 	}
 	e := os.Rename(
-		path.Join(to, "cmd", "server"),
-		path.Join(to, "cmd", p.Name),
+		filepath.Join(to, "cmd", "server"),
+		filepath.Join(to, "cmd", p.Name),
 	)
 	if e != nil {
 		return e
diff --git a/cmd/kratos/internal/project/project.go b/cmd/kratos/internal/project/project.go
index f1f2cea0..fffa0fdc 100644
--- a/cmd/kratos/internal/project/project.go
+++ b/cmd/kratos/internal/project/project.go
@@ -5,7 +5,6 @@ import (
 	"errors"
 	"fmt"
 	"os"
-	"path"
 	"path/filepath"
 	"strings"
 	"time"
@@ -80,7 +79,7 @@ func run(_ *cobra.Command, args []string) {
 			return
 		}
 
-		mod, e := base.ModulePath(path.Join(projectRoot, "go.mod"))
+		mod, e := base.ModulePath(filepath.Join(projectRoot, "go.mod"))
 		if e != nil {
 			panic(e)
 		}
@@ -136,6 +135,6 @@ func getgomodProjectRoot(dir string) string {
 }
 
 func gomodIsNotExistIn(dir string) bool {
-	_, e := os.Stat(path.Join(dir, "go.mod"))
+	_, e := os.Stat(filepath.Join(dir, "go.mod"))
 	return os.IsNotExist(e)
 }
diff --git a/cmd/kratos/internal/proto/add/proto.go b/cmd/kratos/internal/proto/add/proto.go
index 8c716dc6..88184a28 100644
--- a/cmd/kratos/internal/proto/add/proto.go
+++ b/cmd/kratos/internal/proto/add/proto.go
@@ -3,7 +3,7 @@ package add
 import (
 	"fmt"
 	"os"
-	"path"
+	"path/filepath"
 )
 
 // Proto is a proto generator.
@@ -26,13 +26,13 @@ func (p *Proto) Generate() error {
 	if err != nil {
 		panic(err)
 	}
-	to := path.Join(wd, p.Path)
+	to := filepath.Join(wd, p.Path)
 	if _, err := os.Stat(to); os.IsNotExist(err) {
 		if err := os.MkdirAll(to, 0o700); err != nil {
 			return err
 		}
 	}
-	name := path.Join(to, p.Name)
+	name := filepath.Join(to, p.Name)
 	if _, err := os.Stat(name); !os.IsNotExist(err) {
 		return fmt.Errorf("%s already exists", p.Name)
 	}
diff --git a/cmd/kratos/internal/proto/server/server.go b/cmd/kratos/internal/proto/server/server.go
index 41fb9ee7..8a30d93c 100644
--- a/cmd/kratos/internal/proto/server/server.go
+++ b/cmd/kratos/internal/proto/server/server.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"log"
 	"os"
-	"path"
+	"path/filepath"
 	"strings"
 
 	"github.com/emicklei/proto"
@@ -16,8 +16,8 @@ import (
 // CmdServer the service command.
 var CmdServer = &cobra.Command{
 	Use:   "server",
-	Short: "Generate the proto Server implementations",
-	Long:  "Generate the proto Server implementations. Example: kratos proto server api/xxx.proto --target-dir=internal/service",
+	Short: "Generate the proto server implementations",
+	Long:  "Generate the proto server implementations. Example: kratos proto server api/xxx.proto --target-dir=internal/service",
 	Run:   run,
 }
 var targetDir string
@@ -64,8 +64,8 @@ func run(_ *cobra.Command, args []string) {
 					continue
 				}
 				cs.Methods = append(cs.Methods, &Method{
-					Service: serviceName(s.Name), Name: serviceName(r.Name), Request: r.RequestType,
-					Reply: r.ReturnsType, Type: getMethodType(r.StreamsRequest, r.StreamsReturns),
+					Service: serviceName(s.Name), Name: serviceName(r.Name), Request: parametersName(r.RequestType),
+					Reply: parametersName(r.ReturnsType), Type: getMethodType(r.StreamsRequest, r.StreamsReturns),
 				})
 			}
 			res = append(res, cs)
@@ -76,7 +76,7 @@ func run(_ *cobra.Command, args []string) {
 		return
 	}
 	for _, s := range res {
-		to := path.Join(targetDir, strings.ToLower(s.Service)+".go")
+		to := filepath.Join(targetDir, strings.ToLower(s.Service)+".go")
 		if _, err := os.Stat(to); !os.IsNotExist(err) {
 			fmt.Fprintf(os.Stderr, "%s already exists: %s\n", s.Service, to)
 			continue
@@ -105,6 +105,10 @@ func getMethodType(streamsRequest, streamsReturns bool) MethodType {
 	return unaryType
 }
 
+func parametersName(name string) string {
+	return strings.ReplaceAll(name, ".", "_")
+}
+
 func serviceName(name string) string {
 	return toUpperCamelCase(strings.Split(name, ".")[0])
 }
diff --git a/cmd/kratos/internal/run/run.go b/cmd/kratos/internal/run/run.go
index 005c832a..2def97a1 100644
--- a/cmd/kratos/internal/run/run.go
+++ b/cmd/kratos/internal/run/run.go
@@ -4,7 +4,6 @@ import (
 	"fmt"
 	"os"
 	"os/exec"
-	"path"
 	"path/filepath"
 	"strings"
 
@@ -108,7 +107,7 @@ func findCMD(base string) (map[string]string, error) {
 				}
 				for _, fileInfo := range paths {
 					if fileInfo.IsDir() {
-						abs := path.Join(walkPath, fileInfo.Name())
+						abs := filepath.Join(walkPath, fileInfo.Name())
 						cmdPath[strings.TrimPrefix(abs, wd)] = abs
 					}
 				}
diff --git a/contrib/log/aliyun/go.mod b/contrib/log/aliyun/go.mod
index f75a8148..1fcdfa34 100644
--- a/contrib/log/aliyun/go.mod
+++ b/contrib/log/aliyun/go.mod
@@ -5,7 +5,7 @@ go 1.16
 require (
 	github.com/aliyun/aliyun-log-go-sdk v0.1.43
 	github.com/go-kratos/kratos/v2 v2.6.1
-	google.golang.org/protobuf v1.28.1
+	google.golang.org/protobuf v1.30.0
 )
 
 replace (
diff --git a/contrib/log/aliyun/go.sum b/contrib/log/aliyun/go.sum
index b60a8d88..cd68d59f 100644
--- a/contrib/log/aliyun/go.sum
+++ b/contrib/log/aliyun/go.sum
@@ -481,8 +481,8 @@ 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=
-google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
-google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
+google.golang.org/protobuf v1.30.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=
diff --git a/contrib/opensergo/opensergo.go b/contrib/opensergo/opensergo.go
index e8f38c7b..56de2536 100644
--- a/contrib/opensergo/opensergo.go
+++ b/contrib/opensergo/opensergo.go
@@ -9,8 +9,6 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/go-kratos/kratos/v2"
-
 	v1 "github.com/opensergo/opensergo-go/proto/service_contract/v1"
 	"golang.org/x/net/context"
 	"google.golang.org/genproto/googleapis/api/annotations"
@@ -19,6 +17,8 @@ import (
 	"google.golang.org/protobuf/proto"
 	"google.golang.org/protobuf/reflect/protoreflect"
 	"google.golang.org/protobuf/reflect/protoregistry"
+
+	"github.com/go-kratos/kratos/v2"
 )
 
 type Option func(*options)
diff --git a/contrib/registry/servicecomb/registry.go b/contrib/registry/servicecomb/registry.go
index 3e2a0e9f..d2e9a853 100644
--- a/contrib/registry/servicecomb/registry.go
+++ b/contrib/registry/servicecomb/registry.go
@@ -124,9 +124,6 @@ func (r *Registry) Register(_ context.Context, svcIns *registry.ServiceInstance)
 		// 保存当前版本微服务对应的sid
 		curServiceID = sid
 	}
-	props := make(map[string]string)
-	props[appIDKey] = appID
-	props[envKey] = env
 	if svcIns.ID == "" {
 		var id uuid.UUID
 		id, err = uuid.NewV4()
@@ -135,6 +132,10 @@ func (r *Registry) Register(_ context.Context, svcIns *registry.ServiceInstance)
 		}
 		svcIns.ID = id.String()
 	}
+	props := map[string]string{
+		appIDKey: appID,
+		envKey:   env,
+	}
 	_, err = r.cli.RegisterMicroServiceInstance(&discovery.MicroServiceInstance{
 		InstanceId: svcIns.ID,
 		ServiceId:  sid,
@@ -146,9 +147,9 @@ func (r *Registry) Register(_ context.Context, svcIns *registry.ServiceInstance)
 	if err != nil {
 		return err
 	}
-	ticker := time.NewTicker(30 * time.Second)
-	defer ticker.Stop()
 	go func() {
+		ticker := time.NewTicker(30 * time.Second)
+		defer ticker.Stop()
 		for {
 			<-ticker.C
 			_, err = r.cli.Heartbeat(sid, svcIns.ID)
diff --git a/contrib/registry/servicecomb/watcher.go b/contrib/registry/servicecomb/watcher.go
index b1f4fccf..cc4545cc 100644
--- a/contrib/registry/servicecomb/watcher.go
+++ b/contrib/registry/servicecomb/watcher.go
@@ -1,8 +1,9 @@
 package servicecomb
 
 import (
+	"context"
+
 	"github.com/go-chassis/sc-client"
-	"golang.org/x/net/context"
 
 	"github.com/go-kratos/kratos/v2/registry"
 )
diff --git a/log/helper.go b/log/helper.go
index b01c947a..cc0cb8c9 100644
--- a/log/helper.go
+++ b/log/helper.go
@@ -14,8 +14,10 @@ type Option func(*Helper)
 
 // Helper is a logger helper.
 type Helper struct {
-	logger Logger
-	msgKey string
+	logger  Logger
+	msgKey  string
+	sprint  func(...interface{}) string
+	sprintf func(format string, a ...interface{}) string
 }
 
 // WithMessageKey with message key.
@@ -25,11 +27,27 @@ func WithMessageKey(k string) Option {
 	}
 }
 
+// WithSprint with sprint
+func WithSprint(sprint func(...interface{}) string) Option {
+	return func(opts *Helper) {
+		opts.sprint = sprint
+	}
+}
+
+// WithSprintf with sprintf
+func WithSprintf(sprintf func(format string, a ...interface{}) string) Option {
+	return func(opts *Helper) {
+		opts.sprintf = sprintf
+	}
+}
+
 // NewHelper new a logger helper.
 func NewHelper(logger Logger, opts ...Option) *Helper {
 	options := &Helper{
-		msgKey: DefaultMessageKey, // default message key
-		logger: logger,
+		msgKey:  DefaultMessageKey, // default message key
+		logger:  logger,
+		sprint:  fmt.Sprint,
+		sprintf: fmt.Sprintf,
 	}
 	for _, o := range opts {
 		o(options)
@@ -41,8 +59,10 @@ func NewHelper(logger Logger, opts ...Option) *Helper {
 // to ctx. The provided ctx must be non-nil.
 func (h *Helper) WithContext(ctx context.Context) *Helper {
 	return &Helper{
-		msgKey: h.msgKey,
-		logger: WithContext(ctx, h.logger),
+		msgKey:  h.msgKey,
+		logger:  WithContext(ctx, h.logger),
+		sprint:  h.sprint,
+		sprintf: h.sprintf,
 	}
 }
 
@@ -53,12 +73,12 @@ func (h *Helper) Log(level Level, keyvals ...interface{}) {
 
 // Debug logs a message at debug level.
 func (h *Helper) Debug(a ...interface{}) {
-	_ = h.logger.Log(LevelDebug, h.msgKey, fmt.Sprint(a...))
+	_ = h.logger.Log(LevelDebug, h.msgKey, h.sprint(a...))
 }
 
 // Debugf logs a message at debug level.
 func (h *Helper) Debugf(format string, a ...interface{}) {
-	_ = h.logger.Log(LevelDebug, h.msgKey, fmt.Sprintf(format, a...))
+	_ = h.logger.Log(LevelDebug, h.msgKey, h.sprintf(format, a...))
 }
 
 // Debugw logs a message at debug level.
@@ -68,12 +88,12 @@ func (h *Helper) Debugw(keyvals ...interface{}) {
 
 // Info logs a message at info level.
 func (h *Helper) Info(a ...interface{}) {
-	_ = h.logger.Log(LevelInfo, h.msgKey, fmt.Sprint(a...))
+	_ = h.logger.Log(LevelInfo, h.msgKey, h.sprint(a...))
 }
 
 // Infof logs a message at info level.
 func (h *Helper) Infof(format string, a ...interface{}) {
-	_ = h.logger.Log(LevelInfo, h.msgKey, fmt.Sprintf(format, a...))
+	_ = h.logger.Log(LevelInfo, h.msgKey, h.sprintf(format, a...))
 }
 
 // Infow logs a message at info level.
@@ -83,12 +103,12 @@ func (h *Helper) Infow(keyvals ...interface{}) {
 
 // Warn logs a message at warn level.
 func (h *Helper) Warn(a ...interface{}) {
-	_ = h.logger.Log(LevelWarn, h.msgKey, fmt.Sprint(a...))
+	_ = h.logger.Log(LevelWarn, h.msgKey, h.sprint(a...))
 }
 
 // Warnf logs a message at warnf level.
 func (h *Helper) Warnf(format string, a ...interface{}) {
-	_ = h.logger.Log(LevelWarn, h.msgKey, fmt.Sprintf(format, a...))
+	_ = h.logger.Log(LevelWarn, h.msgKey, h.sprintf(format, a...))
 }
 
 // Warnw logs a message at warnf level.
@@ -98,12 +118,12 @@ func (h *Helper) Warnw(keyvals ...interface{}) {
 
 // Error logs a message at error level.
 func (h *Helper) Error(a ...interface{}) {
-	_ = h.logger.Log(LevelError, h.msgKey, fmt.Sprint(a...))
+	_ = h.logger.Log(LevelError, h.msgKey, h.sprint(a...))
 }
 
 // Errorf logs a message at error level.
 func (h *Helper) Errorf(format string, a ...interface{}) {
-	_ = h.logger.Log(LevelError, h.msgKey, fmt.Sprintf(format, a...))
+	_ = h.logger.Log(LevelError, h.msgKey, h.sprintf(format, a...))
 }
 
 // Errorw logs a message at error level.
@@ -113,13 +133,13 @@ func (h *Helper) Errorw(keyvals ...interface{}) {
 
 // Fatal logs a message at fatal level.
 func (h *Helper) Fatal(a ...interface{}) {
-	_ = h.logger.Log(LevelFatal, h.msgKey, fmt.Sprint(a...))
+	_ = h.logger.Log(LevelFatal, h.msgKey, h.sprint(a...))
 	os.Exit(1)
 }
 
 // Fatalf logs a message at fatal level.
 func (h *Helper) Fatalf(format string, a ...interface{}) {
-	_ = h.logger.Log(LevelFatal, h.msgKey, fmt.Sprintf(format, a...))
+	_ = h.logger.Log(LevelFatal, h.msgKey, h.sprintf(format, a...))
 	os.Exit(1)
 }
 
diff --git a/middleware/tracing/statsHandler.go b/middleware/tracing/statshandler.go
similarity index 86%
rename from middleware/tracing/statsHandler.go
rename to middleware/tracing/statshandler.go
index 594be9e1..39598f1d 100644
--- a/middleware/tracing/statsHandler.go
+++ b/middleware/tracing/statshandler.go
@@ -31,9 +31,9 @@ func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) {
 	if !ok {
 		return
 	}
-	remoteAddr := p.Addr.String()
-	if span := trace.SpanFromContext(ctx); span.SpanContext().IsValid() {
-		span.SetAttributes(peerAttr(remoteAddr)...)
+	span := trace.SpanFromContext(ctx)
+	if span.SpanContext().IsValid() {
+		span.SetAttributes(peerAttr(p.Addr.String())...)
 	}
 }
 
diff --git a/selector/p2c/p2c.go b/selector/p2c/p2c.go
index 1d0ef8c5..afca9807 100644
--- a/selector/p2c/p2c.go
+++ b/selector/p2c/p2c.go
@@ -13,16 +13,16 @@ import (
 
 const (
 	forcePick = time.Second * 3
-	// Name is balancer name
+	// Name is p2c(Pick of 2 choices) balancer name
 	Name = "p2c"
 )
 
 var _ selector.Balancer = (*Balancer)(nil)
 
-// Option is random builder option.
+// Option is p2c builder option.
 type Option func(o *options)
 
-// options is random builder options
+// options is p2c builder options
 type options struct{}
 
 // New creates a p2c selector.
diff --git a/selector/wrr/wrr.go b/selector/wrr/wrr.go
index 3d91d62e..f81d7171 100644
--- a/selector/wrr/wrr.go
+++ b/selector/wrr/wrr.go
@@ -9,19 +9,19 @@ import (
 )
 
 const (
-	// Name is wrr balancer name
+	// Name is wrr(Weighted Round Robin) balancer name
 	Name = "wrr"
 )
 
 var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name
 
-// Option is random builder option.
+// Option is wrr builder option.
 type Option func(o *options)
 
-// options is random builder options
+// options is wrr builder options
 type options struct{}
 
-// Balancer is a random balancer.
+// Balancer is a wrr balancer.
 type Balancer struct {
 	mu            sync.Mutex
 	currentWeight map[string]float64
diff --git a/transport/grpc/client.go b/transport/grpc/client.go
index a7a00910..3c8a17d7 100644
--- a/transport/grpc/client.go
+++ b/transport/grpc/client.go
@@ -6,6 +6,11 @@ import (
 	"fmt"
 	"time"
 
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/credentials"
+	grpcinsecure "google.golang.org/grpc/credentials/insecure"
+	grpcmd "google.golang.org/grpc/metadata"
+
 	"github.com/go-kratos/kratos/v2/log"
 	"github.com/go-kratos/kratos/v2/middleware"
 	"github.com/go-kratos/kratos/v2/registry"
@@ -16,11 +21,6 @@ import (
 
 	// init resolver
 	_ "github.com/go-kratos/kratos/v2/transport/grpc/resolver/direct"
-
-	"google.golang.org/grpc"
-	"google.golang.org/grpc/credentials"
-	grpcinsecure "google.golang.org/grpc/credentials/insecure"
-	grpcmd "google.golang.org/grpc/metadata"
 )
 
 func init() {
diff --git a/transport/grpc/resolver/discovery/builder.go b/transport/grpc/resolver/discovery/builder.go
index 28aff384..3d147cd8 100644
--- a/transport/grpc/resolver/discovery/builder.go
+++ b/transport/grpc/resolver/discovery/builder.go
@@ -6,10 +6,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/go-kratos/kratos/v2/registry"
-
 	"github.com/google/uuid"
 	"google.golang.org/grpc/resolver"
+
+	"github.com/go-kratos/kratos/v2/registry"
 )
 
 const name = "discovery"
diff --git a/transport/grpc/resolver/discovery/resolver.go b/transport/grpc/resolver/discovery/resolver.go
index 03c76664..10775d74 100644
--- a/transport/grpc/resolver/discovery/resolver.go
+++ b/transport/grpc/resolver/discovery/resolver.go
@@ -6,13 +6,13 @@ import (
 	"errors"
 	"time"
 
+	"google.golang.org/grpc/attributes"
+	"google.golang.org/grpc/resolver"
+
+	"github.com/go-kratos/aegis/subset"
 	"github.com/go-kratos/kratos/v2/internal/endpoint"
 	"github.com/go-kratos/kratos/v2/log"
 	"github.com/go-kratos/kratos/v2/registry"
-
-	"github.com/go-kratos/aegis/subset"
-	"google.golang.org/grpc/attributes"
-	"google.golang.org/grpc/resolver"
 )
 
 type discoveryResolver struct {
@@ -49,9 +49,10 @@ func (r *discoveryResolver) watch() {
 }
 
 func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
-	addrs := make([]resolver.Address, 0)
-	endpoints := make(map[string]struct{})
-	filtered := make([]*registry.ServiceInstance, 0, len(ins))
+	var (
+		endpoints = make(map[string]struct{})
+		filtered  = make([]*registry.ServiceInstance, 0, len(ins))
+	)
 	for _, in := range ins {
 		ept, err := endpoint.ParseEndpoint(in.Endpoints, endpoint.Scheme("grpc", !r.insecure))
 		if err != nil {
@@ -70,15 +71,16 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
 	if r.subsetSize != 0 {
 		filtered = subset.Subset(r.selecterKey, filtered, r.subsetSize)
 	}
+
+	addrs := make([]resolver.Address, 0, len(filtered))
 	for _, in := range filtered {
 		ept, _ := endpoint.ParseEndpoint(in.Endpoints, endpoint.Scheme("grpc", !r.insecure))
 		endpoints[ept] = struct{}{}
 		addr := resolver.Address{
 			ServerName: in.Name,
-			Attributes: parseAttributes(in.Metadata),
+			Attributes: parseAttributes(in.Metadata).WithValue("rawServiceInstance", in),
 			Addr:       ept,
 		}
-		addr.Attributes = addr.Attributes.WithValue("rawServiceInstance", in)
 		addrs = append(addrs, addr)
 	}
 	if len(addrs) == 0 {
@@ -89,7 +91,6 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
 	if err != nil {
 		log.Errorf("[resolver] failed to update state: %s", err)
 	}
-
 	if r.debugLog {
 		b, _ := json.Marshal(filtered)
 		log.Infof("[resolver] update instances: %s", b)
diff --git a/transport/grpc/server.go b/transport/grpc/server.go
index 9a8344bf..6e281b67 100644
--- a/transport/grpc/server.go
+++ b/transport/grpc/server.go
@@ -7,22 +7,20 @@ import (
 	"net/url"
 	"time"
 
-	"github.com/go-kratos/kratos/v2/internal/endpoint"
-	"github.com/go-kratos/kratos/v2/internal/matcher"
-
-	apimd "github.com/go-kratos/kratos/v2/api/metadata"
-
-	"github.com/go-kratos/kratos/v2/internal/host"
-	"github.com/go-kratos/kratos/v2/log"
-	"github.com/go-kratos/kratos/v2/middleware"
-	"github.com/go-kratos/kratos/v2/transport"
-
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/admin"
 	"google.golang.org/grpc/credentials"
 	"google.golang.org/grpc/health"
 	"google.golang.org/grpc/health/grpc_health_v1"
 	"google.golang.org/grpc/reflection"
+
+	apimd "github.com/go-kratos/kratos/v2/api/metadata"
+	"github.com/go-kratos/kratos/v2/internal/endpoint"
+	"github.com/go-kratos/kratos/v2/internal/host"
+	"github.com/go-kratos/kratos/v2/internal/matcher"
+	"github.com/go-kratos/kratos/v2/log"
+	"github.com/go-kratos/kratos/v2/middleware"
+	"github.com/go-kratos/kratos/v2/transport"
 )
 
 var (
diff --git a/transport/http/binding/bind.go b/transport/http/binding/bind.go
index 10007367..69534ada 100644
--- a/transport/http/binding/bind.go
+++ b/transport/http/binding/bind.go
@@ -4,10 +4,9 @@ import (
 	"net/http"
 	"net/url"
 
-	"github.com/go-kratos/kratos/v2/errors"
-
 	"github.com/go-kratos/kratos/v2/encoding"
 	"github.com/go-kratos/kratos/v2/encoding/form"
+	"github.com/go-kratos/kratos/v2/errors"
 )
 
 // BindQuery bind vars parameters to target.
diff --git a/transport/http/binding/encode.go b/transport/http/binding/encode.go
index 72afd508..5f12cf37 100644
--- a/transport/http/binding/encode.go
+++ b/transport/http/binding/encode.go
@@ -20,13 +20,12 @@ func EncodeURL(pathTemplate string, msg interface{}, needQuery bool) string {
 	pathParams := make(map[string]struct{})
 	path := reg.ReplaceAllStringFunc(pathTemplate, func(in string) string {
 		// it's unreachable because the reg means that must have more than one char in {}
-		//if len(in) < 4 { //nolint:gomnd // **  explain the 4 number here :-) **
+		// if len(in) < 4 { //nolint:gomnd // **  explain the 4 number here :-) **
 		//	return in
-		//}
+		// }
 		key := in[1 : len(in)-1]
-		value := queryParams.Get(key)
 		pathParams[key] = struct{}{}
-		return value
+		return queryParams.Get(key)
 	})
 	if !needQuery {
 		if v, ok := msg.(proto.Message); ok {
diff --git a/transport/http/codec.go b/transport/http/codec.go
index 5aef7995..39db4d21 100644
--- a/transport/http/codec.go
+++ b/transport/http/codec.go
@@ -7,12 +7,12 @@ import (
 	"net/http"
 	"net/url"
 
+	"github.com/gorilla/mux"
+
 	"github.com/go-kratos/kratos/v2/encoding"
 	"github.com/go-kratos/kratos/v2/errors"
 	"github.com/go-kratos/kratos/v2/internal/httputil"
 	"github.com/go-kratos/kratos/v2/transport/http/binding"
-
-	"github.com/gorilla/mux"
 )
 
 // SupportPackageIsVersion1 These constants should not be referenced from any other code.
diff --git a/transport/http/codec_go1.20.go b/transport/http/codec_go1.20.go
new file mode 100644
index 00000000..2df5ec92
--- /dev/null
+++ b/transport/http/codec_go1.20.go
@@ -0,0 +1,10 @@
+//go:build go1.20
+// +build go1.20
+
+package http
+
+import "net/http"
+
+// ResponseController is type net/http.ResponseController which was added in Go 1.20.
+
+type ResponseController = http.ResponseController
diff --git a/transport/http/resolver.go b/transport/http/resolver.go
index dbb2211f..bcbf8f3b 100644
--- a/transport/http/resolver.go
+++ b/transport/http/resolver.go
@@ -7,13 +7,13 @@ import (
 	"strings"
 	"time"
 
+	"github.com/google/uuid"
+
+	"github.com/go-kratos/aegis/subset"
 	"github.com/go-kratos/kratos/v2/internal/endpoint"
 	"github.com/go-kratos/kratos/v2/log"
 	"github.com/go-kratos/kratos/v2/registry"
 	"github.com/go-kratos/kratos/v2/selector"
-
-	"github.com/go-kratos/aegis/subset"
-	"github.com/google/uuid"
 )
 
 // Target is resolver target
@@ -135,7 +135,7 @@ func (r *resolver) update(services []*registry.ServiceInstance) bool {
 	if r.subsetSize != 0 {
 		filtered = subset.Subset(r.selecterKey, filtered, r.subsetSize)
 	}
-	nodes := make([]selector.Node, 0)
+	nodes := make([]selector.Node, 0, len(filtered))
 	for _, ins := range filtered {
 		ept, _ := endpoint.ParseEndpoint(ins.Endpoints, endpoint.Scheme("http", !r.insecure))
 		nodes = append(nodes, selector.NewNode("http", ept, ins))
diff --git a/transport/http/server.go b/transport/http/server.go
index 7b27d326..8bece9af 100644
--- a/transport/http/server.go
+++ b/transport/http/server.go
@@ -9,15 +9,14 @@ import (
 	"net/url"
 	"time"
 
-	"github.com/go-kratos/kratos/v2/internal/endpoint"
-	"github.com/go-kratos/kratos/v2/internal/matcher"
+	"github.com/gorilla/mux"
 
+	"github.com/go-kratos/kratos/v2/internal/endpoint"
 	"github.com/go-kratos/kratos/v2/internal/host"
+	"github.com/go-kratos/kratos/v2/internal/matcher"
 	"github.com/go-kratos/kratos/v2/log"
 	"github.com/go-kratos/kratos/v2/middleware"
 	"github.com/go-kratos/kratos/v2/transport"
-
-	"github.com/gorilla/mux"
 )
 
 var (


Test patch:
diff --git a/cmd/kratos/internal/proto/server/server_test.go b/cmd/kratos/internal/proto/server/server_test.go
index fa90f692..891f8bbb 100644
--- a/cmd/kratos/internal/proto/server/server_test.go
+++ b/cmd/kratos/internal/proto/server/server_test.go
@@ -60,3 +60,43 @@ func Test_serviceName(t *testing.T) {
 		})
 	}
 }
+
+func Test_parametersName(t *testing.T) {
+	type args struct {
+		name string
+	}
+	tests := []struct {
+		name string
+		args args
+		want string
+	}{
+		{
+			name: "parametersName on not nested",
+			args: args{
+				name: "MessageResponse",
+			},
+			want: "MessageResponse",
+		},
+		{
+			name: "parametersName on One layer of nesting",
+			args: args{
+				name: "Message.Response",
+			},
+			want: "Message_Response",
+		},
+		{
+			name: "parametersName on Two layer of nesting",
+			args: args{
+				name: "Message.Message2.Response",
+			},
+			want: "Message_Message2_Response",
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := parametersName(tt.args.name); got != tt.want {
+				t.Errorf("parametersName() = %v, want %v", got, tt.want)
+			}
+		})
+	}
+}
diff --git a/middleware/tracing/statsHandler_test.go b/middleware/tracing/statshandler_test.go
similarity index 92%
rename from middleware/tracing/statsHandler_test.go
rename to middleware/tracing/statshandler_test.go
index ec7ea06a..655cfe63 100644
--- a/middleware/tracing/statsHandler_test.go
+++ b/middleware/tracing/statshandler_test.go
@@ -18,7 +18,7 @@ func TestClient_HandleConn(_ *testing.T) {
 	(&ClientHandler{}).HandleConn(context.Background(), nil)
 }
 
-func Test_Client_TagConn(t *testing.T) {
+func TestClient_TagConn(t *testing.T) {
 	client := &ClientHandler{}
 	ctx := context.WithValue(context.Background(), testKey, 123)
 
@@ -27,7 +27,7 @@ func Test_Client_TagConn(t *testing.T) {
 	}
 }
 
-func Test_Client_TagRPC(t *testing.T) {
+func TestClient_TagRPC(t *testing.T) {
 	client := &ClientHandler{}
 	ctx := context.WithValue(context.Background(), testKey, 123)
 
@@ -36,12 +36,10 @@ func Test_Client_TagRPC(t *testing.T) {
 	}
 }
 
-type (
-	mockSpan struct {
-		trace.Span
-		mockSpanCtx *trace.SpanContext
-	}
-)
+type mockSpan struct {
+	trace.Span
+	mockSpanCtx *trace.SpanContext
+}
 
 func (m *mockSpan) SpanContext() trace.SpanContext {
 	return *m.mockSpanCtx
diff --git a/transport/http/binding/bind_test.go b/transport/http/binding/bind_test.go
index 6cd8b6d5..962292c4 100644
--- a/transport/http/binding/bind_test.go
+++ b/transport/http/binding/bind_test.go
@@ -1,6 +1,7 @@
 package binding
 
 import (
+	"errors"
 	"io"
 	"net/http"
 	"net/url"
@@ -8,47 +9,47 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/go-kratos/kratos/v2/errors"
+	kratoserror "github.com/go-kratos/kratos/v2/errors"
 )
 
-func TestBindQuery(t *testing.T) {
-	type TestBind struct {
+type (
+	TestBind struct {
 		Name string `json:"name"`
 		URL  string `json:"url"`
 	}
-
-	type TestBind2 struct {
+	TestBind2 struct {
 		Age int `json:"age"`
 	}
-	p1 := TestBind{}
-	p2 := TestBind2{}
+)
+
+func TestBindQuery(t *testing.T) {
 	type args struct {
 		vars   url.Values
 		target interface{}
 	}
+
 	tests := []struct {
-		name    string
-		args    args
-		wantErr bool
-		want    interface{}
+		name string
+		args args
+		err  error
+		want interface{}
 	}{
 		{
 			name: "test",
 			args: args{
 				vars:   map[string][]string{"name": {"kratos"}, "url": {"https://go-kratos.dev/"}},
-				target: &p1,
+				target: &TestBind{},
 			},
-			wantErr: false,
-			want:    &TestBind{"kratos", "https://go-kratos.dev/"},
+			err:  nil,
+			want: &TestBind{"kratos", "https://go-kratos.dev/"},
 		},
 		{
 			name: "test1",
 			args: args{
 				vars:   map[string][]string{"age": {"kratos"}, "url": {"https://go-kratos.dev/"}},
-				target: &p2,
+				target: &TestBind2{},
 			},
-			wantErr: true,
-			want:    errors.BadRequest("CODEC", ""),
+			err: kratoserror.BadRequest("CODEC", "Field Namespace:age ERROR:Invalid Integer Value 'kratos' Type 'int' Namespace 'age'"),
 		},
 		{
 			name: "test2",
@@ -56,18 +57,17 @@ func TestBindQuery(t *testing.T) {
 				vars:   map[string][]string{"age": {"1"}, "url": {"https://go-kratos.dev/"}},
 				target: &TestBind2{},
 			},
-			wantErr: false,
-			want:    &TestBind2{Age: 1},
+			err:  nil,
+			want: &TestBind2{Age: 1},
 		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			if err := BindQuery(tt.args.vars, tt.args.target); (err != nil) != tt.wantErr {
-				t.Errorf("BindQuery() error = %v, wantErr %v", err, tt.wantErr)
-			} else {
-				t.Log(err)
+			err := BindQuery(tt.args.vars, tt.args.target)
+			if !kratoserror.Is(err, tt.err) {
+				t.Fatalf("BindQuery() error = %v, err %v", err, tt.err)
 			}
-			if !tt.wantErr && !reflect.DeepEqual(tt.args.target, tt.want) {
+			if err == nil && !reflect.DeepEqual(tt.args.target, tt.want) {
 				t.Errorf("BindQuery() target = %v, want %v", tt.args.target, tt.want)
 			}
 		})
@@ -75,32 +75,25 @@ func TestBindQuery(t *testing.T) {
 }
 
 func TestBindForm(t *testing.T) {
-	type TestBind struct {
-		Name string `json:"name"`
-		URL  string `json:"url"`
-	}
-	type TestBind2 struct {
-		Age int `json:"age"`
-	}
-	p1 := TestBind{}
 	type args struct {
 		req    *http.Request
 		target interface{}
 	}
+
 	tests := []struct {
-		name    string
-		args    args
-		wantErr bool
-		want    interface{}
+		name string
+		args args
+		err  error
+		want *TestBind
 	}{
 		{
 			name: "error not nil",
 			args: args{
 				req:    &http.Request{Method: http.MethodPost},
-				target: &p1,
+				target: &TestBind{},
 			},
-			wantErr: true,
-			want:    nil,
+			err:  errors.New("missing form body"),
+			want: nil,
 		},
 		{
 			name: "error is nil",
@@ -110,10 +103,10 @@ func TestBindForm(t *testing.T) {
 					Header: http.Header{"Content-Type": {"application/x-www-form-urlencoded; param=value"}},
 					Body:   io.NopCloser(strings.NewReader("name=kratos&url=https://go-kratos.dev/")),
 				},
-				target: &p1,
+				target: &TestBind{},
 			},
-			wantErr: false,
-			want:    &TestBind{"kratos", "https://go-kratos.dev/"},
+			err:  nil,
+			want: &TestBind{"kratos", "https://go-kratos.dev/"},
 		},
 		{
 			name: "error BadRequest",
@@ -125,18 +118,17 @@ func TestBindForm(t *testing.T) {
 				},
 				target: &TestBind2{},
 			},
-			wantErr: true,
-			want:    nil,
+			err:  kratoserror.BadRequest("CODEC", "Field Namespace:age ERROR:Invalid Integer Value 'a' Type 'int' Namespace 'age'"),
+			want: nil,
 		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
 			err := BindForm(tt.args.req, tt.args.target)
-			if (err != nil) != tt.wantErr {
-				t.Errorf("BindForm() error = %v, wantErr %v", err, tt.wantErr)
+			if !reflect.DeepEqual(err, tt.err) {
+				t.Fatalf("BindForm() error = %v, err %v", err, tt.err)
 			}
-			t.Log(err)
-			if !tt.wantErr && !reflect.DeepEqual(tt.args.target, tt.want) {
+			if err == nil && !reflect.DeepEqual(tt.args.target, tt.want) {
 				t.Errorf("BindForm() target = %v, want %v", tt.args.target, tt.want)
 			}
 		})
diff --git a/transport/http/client_test.go b/transport/http/client_test.go
index 063878af..25ae9a8e 100644
--- a/transport/http/client_test.go
+++ b/transport/http/client_test.go
@@ -227,7 +227,7 @@ func TestDefaultResponseDecoder(t *testing.T) {
 	resp1 := &http.Response{
 		Header:     make(http.Header),
 		StatusCode: 200,
-		Body:       io.NopCloser(bytes.NewBufferString("{\"a\":\"1\", \"b\": 2}")),
+		Body:       io.NopCloser(bytes.NewBufferString(`{"a":"1", "b": 2}`)),
 	}
 	v1 := &struct {
 		A string `json:"a"`
@@ -279,7 +279,7 @@ func TestDefaultErrorDecoder(t *testing.T) {
 	resp2 := &http.Response{
 		Header:     make(http.Header),
 		StatusCode: 500,
-		Body:       io.NopCloser(bytes.NewBufferString("{\"code\":54321, \"message\": \"hi\", \"reason\": \"FOO\"}")),
+		Body:       io.NopCloser(bytes.NewBufferString(`{"code":54321, "message": "hi", "reason": "FOO"}`)),
 	}
 	err := DefaultErrorDecoder(context.TODO(), resp2)
 	if err == nil {