Skip to content

Commit 25a5fe4

Browse files
authored
Leave allocation capacity guessing to the runtime (#716)
1 parent 2975a21 commit 25a5fe4

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

jsoninfo/marshal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type ObjectEncoder struct {
2323

2424
func NewObjectEncoder() *ObjectEncoder {
2525
return &ObjectEncoder{
26-
result: make(map[string]json.RawMessage, 8),
26+
result: make(map[string]json.RawMessage),
2727
}
2828
}
2929

openapi2/openapi2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (doc *T) UnmarshalJSON(data []byte) error {
4242
func (doc *T) AddOperation(path string, method string, operation *Operation) {
4343
paths := doc.Paths
4444
if paths == nil {
45-
paths = make(map[string]*PathItem, 8)
45+
paths = make(map[string]*PathItem)
4646
doc.Paths = paths
4747
}
4848
pathItem := paths[path]
@@ -77,7 +77,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
7777
}
7878

7979
func (pathItem *PathItem) Operations() map[string]*Operation {
80-
operations := make(map[string]*Operation, 8)
80+
operations := make(map[string]*Operation)
8181
if v := pathItem.Delete; v != nil {
8282
operations[http.MethodDelete] = v
8383
}

openapi2conv/openapi2_conv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ func stripNonCustomExtensions(extensions map[string]interface{}) {
12061206
func addPathExtensions(doc2 *openapi2.T, path string, extensionProps openapi3.ExtensionProps) {
12071207
paths := doc2.Paths
12081208
if paths == nil {
1209-
paths = make(map[string]*openapi2.PathItem, 8)
1209+
paths = make(map[string]*openapi2.PathItem)
12101210
doc2.Paths = paths
12111211
}
12121212
pathItem := paths[path]

openapi3/content.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
type Content map[string]*MediaType
1111

1212
func NewContent() Content {
13-
return make(map[string]*MediaType, 4)
13+
return make(map[string]*MediaType)
1414
}
1515

1616
func NewContentWithSchema(schema *Schema, consumes []string) Content {

openapi3/path_item.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
4141
}
4242

4343
func (pathItem *PathItem) Operations() map[string]*Operation {
44-
operations := make(map[string]*Operation, 4)
44+
operations := make(map[string]*Operation)
4545
if v := pathItem.Connect; v != nil {
4646
operations[http.MethodConnect] = v
4747
}

routers/legacy/router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func (router *Router) FindRoute(req *http.Request) (*routers.Route, map[string]s
124124
Reason: routers.ErrPathNotFound.Error(),
125125
}
126126
}
127-
pathParams = make(map[string]string, 8)
127+
pathParams = make(map[string]string)
128128
paramNames, err := server.ParameterNames()
129129
if err != nil {
130130
return nil, nil, err

0 commit comments

Comments
 (0)