diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 974ce964a67..2bb0cb7e5f8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -35,6 +35,6 @@ Usage: `fixes/resolves #`, or `fixes/resolves (paste link of issue #### Other special notes for the reviewers: diff --git a/.golangci.yml b/.golangci.yml index 5e7c6d23ed2..6d021062fe2 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 6f768c4dc65..5cb416bdfe9 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 da9872a8435..aec5ac95e8c 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 8a30d93c46f..665dea8ae07 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/config/options_test.go b/config/options_test.go index 348471d3f70..aebc673af87 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/config/apollo/README.md b/contrib/config/apollo/README.md index a8eea4932f7..3b10738b50e 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 9ed073660b7..0739dcbaccd 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 836960e06c7..946cb590869 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/registry/kubernetes/registry_test.go b/contrib/registry/kubernetes/registry_test.go index 6f9761a455d..1ba71fed185 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 a81c515151e..de13a65b9cb 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/encoding/form/proto_decode.go b/encoding/form/proto_decode.go index cdd93108308..e327b5e004e 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 8d56818200e..1fa8e0a21f3 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 8c4c7b76f32..126763ce8ba 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/filter_test.go b/log/filter_test.go index f95f49769e1..91133c1b788 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/middleware/tracing/metadata.go b/middleware/tracing/metadata.go index 7ad82806aa1..4d9e7de56be 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 867d4f76e9c..6b65ce33e81 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 5a084416a0c..e8e98726f79 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 36effe71505..4a7262a2ee5 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 e0db0cb6703..01c6c628421 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 {