From 0dfec03b68909c1036bb2d4c3f095cb16e4d732f Mon Sep 17 00:00:00 2001 From: "yaoxianjie.dev" Date: Wed, 1 Jun 2022 12:11:10 +0800 Subject: [PATCH] chore(*): fix typos --- pkg/app/client/client.go | 8 ++++---- pkg/app/context.go | 4 ++-- pkg/app/middlewares/server/basic_auth/basic_auth.go | 4 ++-- pkg/common/timer/timer.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/app/client/client.go b/pkg/app/client/client.go index ad40082..cd0aa56 100644 --- a/pkg/app/client/client.go +++ b/pkg/app/client/client.go @@ -672,10 +672,10 @@ func NewClient(opts ...config.ClientOption) (*Client, error) { func (c *Client) Use(mws ...Middleware) { // Put the original middleware to the first - middlwares := make([]Middleware, 0, 1+len(mws)) + middlewares := make([]Middleware, 0, 1+len(mws)) if c.mws != nil { - middlwares = append(middlwares, c.mws) + middlewares = append(middlewares, c.mws) } - middlwares = append(middlwares, mws...) - c.mws = chain(middlwares...) + middlewares = append(middlewares, mws...) + c.mws = chain(middlewares...) } diff --git a/pkg/app/context.go b/pkg/app/context.go index a831442..1e82179 100644 --- a/pkg/app/context.go +++ b/pkg/app/context.go @@ -405,7 +405,7 @@ func (ctx *RequestContext) Write(p []byte) (int, error) { return len(p), nil } -// File writes the specified file into the body stream in a efficient way. +// File writes the specified file into the body stream in an efficient way. func (ctx *RequestContext) File(filepath string) { ServeFile(ctx, filepath) } @@ -420,7 +420,7 @@ func (ctx *RequestContext) FileFromFS(filepath string, fs *FS) { fs.NewRequestHandler()(context.Background(), ctx) } -// FileAttachment use a efficient way to write the file to body stream. +// FileAttachment use an efficient way to write the file to body stream. // // When client download the file, it will rename the file as filename func (ctx *RequestContext) FileAttachment(filepath, filename string) { diff --git a/pkg/app/middlewares/server/basic_auth/basic_auth.go b/pkg/app/middlewares/server/basic_auth/basic_auth.go index 46a5b43..4dfc85c 100644 --- a/pkg/app/middlewares/server/basic_auth/basic_auth.go +++ b/pkg/app/middlewares/server/basic_auth/basic_auth.go @@ -50,10 +50,10 @@ import ( "github.com/cloudwego/hertz/pkg/app" ) -// Accounts is a alias to map[string]string, construct with {"username":"password"} +// Accounts is an alias to map[string]string, construct with {"username":"password"} type Accounts map[string]string -// pairs is a alias to map[string]string, which mean {"header":"username"} +// pairs is an alias to map[string]string, which mean {"header":"username"} type pairs map[string]string func (p pairs) findValue(needle string) (v string, ok bool) { diff --git a/pkg/common/timer/timer.go b/pkg/common/timer/timer.go index b980f09..ac194e6 100644 --- a/pkg/common/timer/timer.go +++ b/pkg/common/timer/timer.go @@ -59,7 +59,7 @@ func initTimer(t *time.Timer, timeout time.Duration) *time.Timer { func stopTimer(t *time.Timer) { if !t.Stop() { // Collect possibly added time from the channel - // if timer has been stopped and nobody collected its' value. + // if timer has been stopped and nobody collected its value. select { case <-t.C: default: @@ -85,7 +85,7 @@ func AcquireTimer(timeout time.Duration) *time.Timer { // ReleaseTimer returns the time.Timer acquired via AcquireTimer to the pool // and prevents the Timer from firing. // -// Do not access the released time.Timer or read from it's channel otherwise +// Do not access the released time.Timer or read from its channel otherwise // data races may occur. func ReleaseTimer(t *time.Timer) { stopTimer(t)