chore(*): fix typos

This commit is contained in:
yaoxianjie.dev 2022-06-01 12:11:10 +08:00
parent 9ced80f0fd
commit 0dfec03b68
4 changed files with 10 additions and 10 deletions

View File

@ -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...)
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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)