Name
Name
func (b *Bucket) Room(rid int) (room *Room) { b.cLock.RLock() room, _ = b.rooms[rid] b.cLock.RUnlock() return } 为何不写作 func (b *Bucket) Room(rid int) (room *Room) { b.cLock.RLock() defer b.cLock.RUnlock() room, _...
Enhance code readability by replacing the original "switch statement and if conditionals" with a simple "for loop" to iterate over the error slice. Below is my local test code: default_validator.go...
Delete unnecessary initialization of the context formCache. Below is my local test code: context.go ```go func (c *Context) initFormCache() { if c.formCache == nil { c.formCache = make(url.Values) req :=...
Replace the `rand.Seed` method which is marked as `Deprecated` in go1.20
Below is my local test code: json.go ```go // Render (AsciiJSON) marshals the given interface object and writes it with custom ContentType. func (r AsciiJSON) Render(w http.ResponseWriter) (err error) {...
Below is my local test code: json.go ```go // Render (JsonpJSON) marshals the given interface object and writes it and its callback with custom ContentType. func (r JsonpJSON) Render(w http.ResponseWriter)...
Replaced `strings.TrimSpace` with `textproto.TrimString` in HTTP header parsing functions to improve performance and better align with HTTP spec. `textproto.TrimString`, which is widely used in `net/http`, trims only ASCII whitespace—making it...
- Moved the generation of `stack` and `secureRequestDump` into conditional blocks so they only execute when needed. - Improved the performance of masking the `Authorization` header by avoiding unnecessary conversions...