mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 02:31:04 +01:00
Remove redundant nil check (#2194)
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>
This commit is contained in:
parent
9f53d15133
commit
6a449876e9
|
@ -244,12 +244,10 @@ func (w *ResponseRecorder) CopyTo(res ResponseWriter) {
|
|||
}
|
||||
|
||||
// append the headers
|
||||
if w.headers != nil {
|
||||
for k, values := range w.headers {
|
||||
for _, v := range values {
|
||||
if to.headers.Get(v) == "" {
|
||||
to.headers.Add(k, v)
|
||||
}
|
||||
for k, values := range w.headers {
|
||||
for _, v := range values {
|
||||
if to.headers.Get(v) == "" {
|
||||
to.headers.Add(k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,12 +319,10 @@ func (w *responseWriter) CopyTo(to ResponseWriter) {
|
|||
}
|
||||
|
||||
// append the headers
|
||||
if w.Header() != nil {
|
||||
for k, values := range w.Header() {
|
||||
for _, v := range values {
|
||||
if to.Header().Get(v) == "" {
|
||||
to.Header().Add(k, v)
|
||||
}
|
||||
for k, values := range w.Header() {
|
||||
for _, v := range values {
|
||||
if to.Header().Get(v) == "" {
|
||||
to.Header().Add(k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,10 +282,8 @@ func (s *JetEngine) initSet() {
|
|||
}
|
||||
|
||||
s.Set = jet.NewSet(s.loader, opts...)
|
||||
if s.vars != nil {
|
||||
for key, value := range s.vars {
|
||||
s.Set.AddGlobal(key, value)
|
||||
}
|
||||
for key, value := range s.vars {
|
||||
s.Set.AddGlobal(key, value)
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
|
|
Loading…
Reference in New Issue
Block a user