Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various typos #3454

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-->
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ linters:
# - nestif
# - prealloc
# - testpackage
# - stylrcheck
# - stylecheck
# - wsl

linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/kratos/internal/proto/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions config/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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()
}
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/config/apollo/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Apollo config centry
## Apollo config center

This module implements the `config.Source` interface in kratos based apollo config management center.

Expand Down
2 changes: 1 addition & 1 deletion contrib/config/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/log/aliyun/aliyun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion contrib/registry/kubernetes/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}()
Expand Down
2 changes: 1 addition & 1 deletion encoding/form/form_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions encoding/form/proto_decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions internal/matcher/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -42,20 +42,20 @@ 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 {
ms := make([]middleware.Middleware, 0, len(m.defaults))
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
Expand Down
2 changes: 1 addition & 1 deletion log/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions log/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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: "",
},
{
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion middleware/tracing/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
4 changes: 2 additions & 2 deletions third_party/validate/validate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion transport/grpc/resolver/discovery/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions transport/grpc/resolver/discovery/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type discoveryResolver struct {

insecure bool
debugLog bool
selecterKey string
selectorKey string
subsetSize int
}

Expand Down Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions transport/http/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type resolver struct {

target *Target
watcher registry.Watcher
selecterKey string
selectorKey string
subsetSize int

insecure bool
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down