Repository: go-kratos/kratos
Pull request #3434 (2024-10-08 03:30:31)

build(deps): bump golang.org/x/net from 0.24.0 to 0.30.0 in /contrib/opensergo
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.24.0 to 0.30.0.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/golang/net/commit/6cc5ac4e9a03d73b331eb1d6db98a02e558243b7"><code>6cc5ac4</code></a> go.mod: update golang.org/x dependencies</li>
<li><a href="https://github.com/golang/net/commit/f88258d67e0f0f144c79964ca05bb81d51ee8411"><code>f88258d</code></a> websocket: update nhooyr.io/websocket to github.com/coder/websocket</li>
<li><a href="https://github.com/golang/net/commit/7191757bc637cf79a7ece0546e33f903bf5e9709"><code>7191757</code></a> http2: add support for net/http HTTP2 config field</li>
<li><a href="https://github.com/golang/net/commit/4790dc7047441aed4889873cdd30e1e6adf49735"><code>4790dc7</code></a> http2: add support for server-originated pings</li>
<li><a href="https://github.com/golang/net/commit/541dbe58b6bc869fc1c7de361846682a34365325"><code>541dbe5</code></a> http2: add Server.WriteByteTimeout</li>
<li><a href="https://github.com/golang/net/commit/3c333c0c5288a7cf127e427ddda5b1b54020a2b4"><code>3c333c0</code></a> route: fix address parsing of messages on Darwin</li>
<li><a href="https://github.com/golang/net/commit/35b4abaed97f1df7ee83c075f500e84d8d75d184"><code>35b4aba</code></a> go.mod: update golang.org/x dependencies</li>
<li><a href="https://github.com/golang/net/commit/9bf379fa3ecca65daf9d75766986d20ea202f7f8"><code>9bf379f</code></a> websocket: fix printf(var) mistake detected by latest printf checker</li>
<li><a href="https://github.com/golang/net/commit/4542a42604cd159f1adb93c58368079ae37b3bf6"><code>4542a42</code></a> go.mod: update golang.org/x dependencies</li>
<li><a href="https://github.com/golang/net/commit/765c7e89b3bdd76bfc210acddd3ca73931eb8d1d"><code>765c7e8</code></a> xsrftoken: create no padding base64 string by RawURLEncoding</li>
<li>Additional commits viewable in <a href="https://github.com/golang/net/compare/v0.24.0...v0.30.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/net&package-manager=go_modules&previous-version=0.24.0&new-version=0.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 show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@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>


Patch:
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 974ce964..2bb0cb7e 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -35,6 +35,6 @@ 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 things that need extra attention for the reviewers
 * Some additional notes, TODO list, etc.
 -->
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 2f9af451..e794e431 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -44,7 +44,7 @@ jobs:
     steps:
       - uses: actions/checkout@v4
       - name: Set up Go
-        uses: actions/setup-go@v5.0.2
+        uses: actions/setup-go@v5.1.0
         with:
           go-version: ${{ matrix.go }}
 
diff --git a/.golangci.yml b/.golangci.yml
index 5e7c6d23..6d021062 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -45,7 +45,7 @@ linters:
   # - nestif
   # - prealloc
   # - testpackage
-  # - stylrcheck
+  # - stylecheck
   # - wsl
 
 linters-settings:
diff --git a/README.md b/README.md
index 6f768c4d..5cb416bd 100644
--- a/README.md
+++ b/README.md
@@ -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 modern projects.
+We also provide a [modern template](https://github.com/go-kratos/kratos-layout). This template should help reduce the work required to set up modern projects.
 
 ### Goals
 
diff --git a/ROADMAP.md b/ROADMAP.md
index da9872a8..aec5ac95 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -41,7 +41,7 @@ This document defines the roadmap for Kratos development.
         - [ ] javascript/typescript clients
     - [x] gRPC
         - [x] TLS
-        - [x] Uarry Handler
+        - [x] Unary Handler
         - [x] Streaming Handler
 - [ ] Cache
     - [ ] go-redis
diff --git a/cmd/kratos/internal/proto/server/server.go b/cmd/kratos/internal/proto/server/server.go
index 8a30d93c..665dea8a 100644
--- a/cmd/kratos/internal/proto/server/server.go
+++ b/cmd/kratos/internal/proto/server/server.go
@@ -72,7 +72,7 @@ func run(_ *cobra.Command, args []string) {
 		}),
 	)
 	if _, err := os.Stat(targetDir); os.IsNotExist(err) {
-		fmt.Printf("Target directory: %s does not exsit\n", targetDir)
+		fmt.Printf("Target directory: %s does not exist\n", targetDir)
 		return
 	}
 	for _, s := range res {
diff --git a/contrib/config/apollo/README.md b/contrib/config/apollo/README.md
index a8eea493..3b10738b 100644
--- a/contrib/config/apollo/README.md
+++ b/contrib/config/apollo/README.md
@@ -1,4 +1,4 @@
-## Apollo config centry
+## Apollo config center
 
 This module implements the `config.Source` interface in kratos based apollo config management center.
 
diff --git a/contrib/config/kubernetes/README.md b/contrib/config/kubernetes/README.md
index 9ed07366..0739dcba 100644
--- a/contrib/config/kubernetes/README.md
+++ b/contrib/config/kubernetes/README.md
@@ -7,7 +7,7 @@ execute this command:
 ```
 kubectl create clusterrolebinding go-kratos:kube --clusterrole=view --serviceaccount=mesh:default
 ```
-or use `kubect apply -f bind-role.yaml`
+or use `kubectl apply -f bind-role.yaml`
 ```yaml
 apiVersion: rbac.authorization.k8s.io/v1
 kind: ClusterRoleBinding
diff --git a/contrib/log/aliyun/aliyun.go b/contrib/log/aliyun/aliyun.go
index 836960e0..946cb590 100644
--- a/contrib/log/aliyun/aliyun.go
+++ b/contrib/log/aliyun/aliyun.go
@@ -102,7 +102,7 @@ func (a *aliyunLog) Log(level log.Level, keyvals ...interface{}) error {
 	return a.producer.SendLog(a.opts.project, a.opts.logstore, "", "", logInst)
 }
 
-// NewAliyunLog new a aliyun logger with options.
+// NewAliyunLog new aliyun logger with options.
 func NewAliyunLog(options ...Option) Logger {
 	opts := defaultOptions()
 	for _, o := range options {
diff --git a/contrib/opensergo/go.mod b/contrib/opensergo/go.mod
index ebd7a00b..24d54039 100644
--- a/contrib/opensergo/go.mod
+++ b/contrib/opensergo/go.mod
@@ -5,7 +5,7 @@ go 1.19
 require (
 	github.com/go-kratos/kratos/v2 v2.8.2
 	github.com/opensergo/opensergo-go v0.0.0-20220331070310-e5b01fee4d1c
-	golang.org/x/net v0.24.0
+	golang.org/x/net v0.30.0
 	google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917
 	google.golang.org/grpc v1.61.1
 	google.golang.org/protobuf v1.33.0
@@ -16,9 +16,9 @@ require (
 	github.com/golang/protobuf v1.5.4 // indirect
 	github.com/google/uuid v1.4.0 // indirect
 	github.com/kr/text v0.2.0 // indirect
-	golang.org/x/sync v0.5.0 // indirect
-	golang.org/x/sys v0.19.0 // indirect
-	golang.org/x/text v0.14.0 // indirect
+	golang.org/x/sync v0.8.0 // indirect
+	golang.org/x/sys v0.26.0 // indirect
+	golang.org/x/text v0.19.0 // indirect
 	google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect
 	google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
diff --git a/contrib/opensergo/go.sum b/contrib/opensergo/go.sum
index 66a3c6e7..ca01113e 100644
--- a/contrib/opensergo/go.sum
+++ b/contrib/opensergo/go.sum
@@ -79,25 +79,25 @@ golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73r
 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
-golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
+golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
+golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
-golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
-golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
+golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
-golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
+golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
+golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
 golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
diff --git a/encoding/form/proto_decode.go b/encoding/form/proto_decode.go
index cdd93108..e327b5e0 100644
--- a/encoding/form/proto_decode.go
+++ b/encoding/form/proto_decode.go
@@ -20,7 +20,7 @@ import (
 	"google.golang.org/protobuf/types/known/wrapperspb"
 )
 
-const fieldSeparater = "."
+const fieldSeparator = "."
 
 var errInvalidFormatMapKey = errors.New("invalid formatting for map key")
 
@@ -138,7 +138,7 @@ func populateRepeatedField(fd protoreflect.FieldDescriptor, list protoreflect.Li
 }
 
 func populateMapField(fd protoreflect.FieldDescriptor, mp protoreflect.Map, fieldPath []string, values []string) error {
-	_, keyName, err := parseURLQueryMapKey(strings.Join(fieldPath, fieldSeparater))
+	_, keyName, err := parseURLQueryMapKey(strings.Join(fieldPath, fieldSeparator))
 	if err != nil {
 		return err
 	}
@@ -359,7 +359,7 @@ func parseURLQueryMapKey(key string) (string, string, error) {
 	)
 	if startIndex < 0 {
 		//nolint:mnd
-		values := strings.Split(key, fieldSeparater)
+		values := strings.Split(key, fieldSeparator)
 		//nolint:mnd
 		if len(values) != 2 {
 			return "", "", errInvalidFormatMapKey
diff --git a/internal/matcher/middleware.go b/internal/matcher/middleware.go
index 8d568182..1fa8e0a2 100644
--- a/internal/matcher/middleware.go
+++ b/internal/matcher/middleware.go
@@ -17,14 +17,14 @@ type Matcher interface {
 // New new a middleware matcher.
 func New() Matcher {
 	return &matcher{
-		matchs: make(map[string][]middleware.Middleware),
+		matches: make(map[string][]middleware.Middleware),
 	}
 }
 
 type matcher struct {
 	prefix   []string
 	defaults []middleware.Middleware
-	matchs   map[string][]middleware.Middleware
+	matches  map[string][]middleware.Middleware
 }
 
 func (m *matcher) Use(ms ...middleware.Middleware) {
@@ -42,7 +42,7 @@ func (m *matcher) Add(selector string, ms ...middleware.Middleware) {
 			return m.prefix[i] > m.prefix[j]
 		})
 	}
-	m.matchs[selector] = ms
+	m.matches[selector] = ms
 }
 
 func (m *matcher) Match(operation string) []middleware.Middleware {
@@ -50,12 +50,12 @@ func (m *matcher) Match(operation string) []middleware.Middleware {
 	if len(m.defaults) > 0 {
 		ms = append(ms, m.defaults...)
 	}
-	if next, ok := m.matchs[operation]; ok {
+	if next, ok := m.matches[operation]; ok {
 		return append(ms, next...)
 	}
 	for _, prefix := range m.prefix {
 		if strings.HasPrefix(operation, prefix) {
-			return append(ms, m.matchs[prefix]...)
+			return append(ms, m.matches[prefix]...)
 		}
 	}
 	return ms
diff --git a/log/README.md b/log/README.md
index 8c4c7b76..126763ce 100644
--- a/log/README.md
+++ b/log/README.md
@@ -8,7 +8,7 @@
 logger := log.NewStdLogger(os.Stdout)
 // fields & valuer
 logger = log.With(logger,
-    "service.name", "hellworld",
+    "service.name", "helloworld",
     "service.version", "v1.0.0",
     "ts", log.DefaultTimestamp,
     "caller", log.DefaultCaller,
diff --git a/log/global.go b/log/global.go
index f1984fc3..ae9244df 100644
--- a/log/global.go
+++ b/log/global.go
@@ -13,7 +13,7 @@ var global = &loggerAppliance{}
 // loggerAppliance is the proxy of `Logger` to
 // make logger change will affect all sub-logger.
 type loggerAppliance struct {
-	lock sync.Mutex
+	lock sync.RWMutex
 	Logger
 }
 
@@ -35,7 +35,9 @@ func SetLogger(logger Logger) {
 
 // GetLogger returns global logger appliance as logger in current process.
 func GetLogger() Logger {
-	return global
+	global.lock.RLock()
+	defer global.lock.RUnlock()
+	return global.Logger
 }
 
 // Log Print log by level and keyvals.
diff --git a/middleware/tracing/metadata.go b/middleware/tracing/metadata.go
index 7ad82806..4d9e7de5 100644
--- a/middleware/tracing/metadata.go
+++ b/middleware/tracing/metadata.go
@@ -40,7 +40,7 @@ func (b Metadata) Extract(parent context.Context, carrier propagation.TextMapCar
 	return parent
 }
 
-// Fields returns the keys who's values are set with Inject.
+// Fields returns the keys whose values are set with Inject.
 func (b Metadata) Fields() []string {
 	return []string{serviceHeader}
 }
diff --git a/third_party/validate/validate.proto b/third_party/validate/validate.proto
index 867d4f76..6b65ce33 100644
--- a/third_party/validate/validate.proto
+++ b/third_party/validate/validate.proto
@@ -535,7 +535,7 @@ message StringRules {
     // at a maximum
     optional uint64 max_bytes = 5;
 
-    // Pattern specifes that this field must match against the specified
+    // Pattern specifies that this field must match against the specified
     // regular expression (RE2 syntax). The included expression should elide
     // any delimiters.
     optional string pattern  = 6;
@@ -647,7 +647,7 @@ message BytesRules {
     // at a maximum
     optional uint64 max_len = 3;
 
-    // Pattern specifes that this field must match against the specified
+    // Pattern specifies that this field must match against the specified
     // regular expression (RE2 syntax). The included expression should elide
     // any delimiters.
     optional string pattern  = 4;
diff --git a/transport/grpc/resolver/discovery/builder.go b/transport/grpc/resolver/discovery/builder.go
index 5a084416..e8e98726 100644
--- a/transport/grpc/resolver/discovery/builder.go
+++ b/transport/grpc/resolver/discovery/builder.go
@@ -113,7 +113,7 @@ func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolv
 		insecure:    b.insecure,
 		debugLog:    b.debugLog,
 		subsetSize:  b.subsetSize,
-		selecterKey: uuid.New().String(),
+		selectorKey: uuid.New().String(),
 	}
 	go r.watch()
 	return r, nil
diff --git a/transport/grpc/resolver/discovery/resolver.go b/transport/grpc/resolver/discovery/resolver.go
index 36effe71..4a7262a2 100644
--- a/transport/grpc/resolver/discovery/resolver.go
+++ b/transport/grpc/resolver/discovery/resolver.go
@@ -24,7 +24,7 @@ type discoveryResolver struct {
 
 	insecure    bool
 	debugLog    bool
-	selecterKey string
+	selectorKey string
 	subsetSize  int
 }
 
@@ -70,7 +70,7 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
 		filtered = append(filtered, in)
 	}
 	if r.subsetSize != 0 {
-		filtered = subset.Subset(r.selecterKey, filtered, r.subsetSize)
+		filtered = subset.Subset(r.selectorKey, filtered, r.subsetSize)
 	}
 
 	addrs := make([]resolver.Address, 0, len(filtered))
diff --git a/transport/http/resolver.go b/transport/http/resolver.go
index e0db0cb6..01c6c628 100644
--- a/transport/http/resolver.go
+++ b/transport/http/resolver.go
@@ -47,7 +47,7 @@ type resolver struct {
 
 	target      *Target
 	watcher     registry.Watcher
-	selecterKey string
+	selectorKey string
 	subsetSize  int
 
 	insecure bool
@@ -66,7 +66,7 @@ func newResolver(ctx context.Context, discovery registry.Discovery, target *Targ
 		watcher:     watcher,
 		rebalancer:  rebalancer,
 		insecure:    insecure,
-		selecterKey: uuid.New().String(),
+		selectorKey: uuid.New().String(),
 		subsetSize:  subsetSize,
 	}
 	if block {
@@ -133,7 +133,7 @@ func (r *resolver) update(services []*registry.ServiceInstance) bool {
 		filtered = append(filtered, ins)
 	}
 	if r.subsetSize != 0 {
-		filtered = subset.Subset(r.selecterKey, filtered, r.subsetSize)
+		filtered = subset.Subset(r.selectorKey, filtered, r.subsetSize)
 	}
 	nodes := make([]selector.Node, 0, len(filtered))
 	for _, ins := range filtered {


Test patch:
diff --git a/config/options_test.go b/config/options_test.go
index 348471d3..aebc673a 100644
--- a/config/options_test.go
+++ b/config/options_test.go
@@ -185,7 +185,7 @@ func TestDefaultResolver(t *testing.T) {
 				default:
 					actual = v.Load()
 					if !reflect.DeepEqual(test.expect, actual) {
-						t.Logf("expect: %#v, actural: %#v", test.expect, actual)
+						t.Logf("expect: %#v, actual: %#v", test.expect, actual)
 						t.Fail()
 					}
 				}
@@ -343,7 +343,7 @@ func TestNewDefaultResolver(t *testing.T) {
 				default:
 					actual = v.Load()
 					if !reflect.DeepEqual(test.expect, actual) {
-						t.Logf("expect: %#v, actural: %#v", test.expect, actual)
+						t.Logf("expect: %#v, actual: %#v", test.expect, actual)
 						t.Fail()
 					}
 				}
diff --git a/contrib/registry/kubernetes/registry_test.go b/contrib/registry/kubernetes/registry_test.go
index 6f9761a4..1ba71fed 100644
--- a/contrib/registry/kubernetes/registry_test.go
+++ b/contrib/registry/kubernetes/registry_test.go
@@ -150,7 +150,7 @@ func TestRegistry(t *testing.T) {
 
 	os.Setenv("HOSTNAME", pod.Items[0].Name)
 
-	// Alway remember delete test resource
+	// Always remember delete test resource
 	defer func() {
 		_ = clientSet.AppsV1().Deployments(namespace).Delete(context.Background(), deployName, metav1.DeleteOptions{})
 	}()
diff --git a/encoding/form/form_test.go b/encoding/form/form_test.go
index a81c5151..de13a65b 100644
--- a/encoding/form/form_test.go
+++ b/encoding/form/form_test.go
@@ -237,7 +237,7 @@ func TestDecodeStructPb(t *testing.T) {
 		t.Errorf("except %v, got %v", "kratos", req.Data.GetFields()["name"].GetStringValue())
 	}
 	if len(req.DataList) != 2 {
-		t.Fatalf("execpt %v, got %v", 2, len(req.DataList))
+		t.Fatalf("except %v, got %v", 2, len(req.DataList))
 	}
 	if "kratos" != req.DataList[0].GetFields()["name1"].GetStringValue() {
 		t.Errorf("except %v, got %v", "kratos", req.Data.GetFields()["name1"].GetStringValue())
diff --git a/log/filter_test.go b/log/filter_test.go
index f95f4976..91133c1b 100644
--- a/log/filter_test.go
+++ b/log/filter_test.go
@@ -102,7 +102,7 @@ func TestFilterFuncWitchLoggerPrefix(t *testing.T) {
 		want   string
 	}{
 		{
-			logger: NewFilter(With(NewStdLogger(buf), "caller", "caller", "prefix", "whaterver"), FilterFunc(testFilterFuncWithLoggerPrefix)),
+			logger: NewFilter(With(NewStdLogger(buf), "caller", "caller", "prefix", "whatever"), FilterFunc(testFilterFuncWithLoggerPrefix)),
 			want:   "",
 		},
 		{
@@ -168,7 +168,7 @@ func TestFilterWithContext(t *testing.T) {
 	_ = WithContext(ctx, filter).Log(LevelInfo, "kind", "test")
 
 	if info.String() != "" {
-		t.Error("filter is not woring")
+		t.Error("filter is not working")
 		return
 	}
 
diff --git a/log/global_test.go b/log/global_test.go
index 8ee15705..469fae31 100644
--- a/log/global_test.go
+++ b/log/global_test.go
@@ -117,3 +117,23 @@ func TestGlobalContext(t *testing.T) {
 		t.Errorf("Expected:%s, got:%s", "INFO msg=111", buffer.String())
 	}
 }
+
+func TestContextWithGlobalLog(t *testing.T) {
+	buffer := &bytes.Buffer{}
+
+	type traceKey struct{}
+	// set "trace-id" Valuer
+	newLogger := With(NewStdLogger(buffer), "trace-id", Valuer(func(ctx context.Context) interface{} {
+		return ctx.Value(traceKey{})
+	}))
+
+	SetLogger(newLogger)
+
+	// add value to ctx
+	ctx := context.WithValue(context.Background(), traceKey{}, "test-trace-id")
+
+	_ = WithContext(ctx, GetLogger()).Log(LevelInfo)
+	if buffer.String() != "INFO trace-id=test-trace-id\n" {
+		t.Errorf("Expected:%s, got:%s", "INFO trace-id=test-trace-id", buffer.String())
+	}
+}