mirror of https://github.com/gofiber/fiber.git
♻️ Refactor: Remove redundant nil check (#2584)
From the Go docs: "If the map is nil, the number of iterations is 0." [1] Therefore, an additional nil check for before the loop is unnecessary. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>pull/2585/head
parent
85d1f6895a
commit
242ff94505
|
@ -141,10 +141,8 @@ func New(config ...Config) fiber.Handler {
|
|||
if len(e.cencoding) > 0 {
|
||||
c.Response().Header.SetBytesV(fiber.HeaderContentEncoding, e.cencoding)
|
||||
}
|
||||
if e.headers != nil {
|
||||
for k, v := range e.headers {
|
||||
c.Response().Header.SetBytesV(k, v)
|
||||
}
|
||||
for k, v := range e.headers {
|
||||
c.Response().Header.SetBytesV(k, v)
|
||||
}
|
||||
// Set Cache-Control header if enabled
|
||||
if cfg.CacheControl {
|
||||
|
|
|
@ -199,10 +199,8 @@ func createTagMap(cfg *Config) map[string]LogFunc {
|
|||
},
|
||||
}
|
||||
// merge with custom tags from user
|
||||
if cfg.CustomTags != nil {
|
||||
for k, v := range cfg.CustomTags {
|
||||
tagFunctions[k] = v
|
||||
}
|
||||
for k, v := range cfg.CustomTags {
|
||||
tagFunctions[k] = v
|
||||
}
|
||||
|
||||
return tagFunctions
|
||||
|
|
Loading…
Reference in New Issue