File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package binder
3
3
import (
4
4
"errors"
5
5
"fmt"
6
+ "maps"
6
7
"mime/multipart"
7
8
"reflect"
8
9
"strings"
@@ -115,9 +116,7 @@ func parseToMap(ptr any, data map[string][]string) error {
115
116
return ErrMapNotConvertable
116
117
}
117
118
118
- for k , v := range data {
119
- newMap [k ] = v
120
- }
119
+ maps .Copy (newMap , data )
121
120
case reflect .String , reflect .Interface :
122
121
newMap , ok := ptr .(map [string ]string )
123
122
if ! ok {
Original file line number Diff line number Diff line change 6
6
"errors"
7
7
"io"
8
8
"iter"
9
+ "maps"
9
10
"path/filepath"
10
11
"reflect"
11
12
"slices"
@@ -748,9 +749,7 @@ func (c Cookie) SetCookie(key, val string) {
748
749
749
750
// SetCookies sets multiple cookies from a map.
750
751
func (c Cookie ) SetCookies (m map [string ]string ) {
751
- for k , v := range m {
752
- c [k ] = v
753
- }
752
+ maps .Copy (c , m )
754
753
}
755
754
756
755
// SetCookiesWithStruct sets cookies from a struct.
@@ -800,9 +799,7 @@ func (p PathParam) SetParam(key, val string) {
800
799
801
800
// SetParams sets multiple path parameters from a map.
802
801
func (p PathParam ) SetParams (m map [string ]string ) {
803
- for k , v := range m {
804
- p [k ] = v
805
- }
802
+ maps .Copy (p , m )
806
803
}
807
804
808
805
// SetParamsWithStruct sets multiple path parameters from a struct.
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package logger
2
2
3
3
import (
4
4
"fmt"
5
+ "maps"
5
6
"strings"
6
7
7
8
"github.com/gofiber/fiber/v3"
@@ -204,9 +205,7 @@ func createTagMap(cfg *Config) map[string]LogFunc {
204
205
},
205
206
}
206
207
// merge with custom tags from user
207
- for k , v := range cfg .CustomTags {
208
- tagFunctions [k ] = v
209
- }
208
+ maps .Copy (tagFunctions , cfg .CustomTags )
210
209
211
210
return tagFunctions
212
211
}
You can’t perform that action at this time.
0 commit comments