Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leave allocation capacity guessing to the runtime #716

Merged
merged 1 commit into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jsoninfo/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ObjectEncoder struct {

func NewObjectEncoder() *ObjectEncoder {
return &ObjectEncoder{
result: make(map[string]json.RawMessage, 8),
result: make(map[string]json.RawMessage),
}
}

Expand Down
4 changes: 2 additions & 2 deletions openapi2/openapi2.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (doc *T) UnmarshalJSON(data []byte) error {
func (doc *T) AddOperation(path string, method string, operation *Operation) {
paths := doc.Paths
if paths == nil {
paths = make(map[string]*PathItem, 8)
paths = make(map[string]*PathItem)
doc.Paths = paths
}
pathItem := paths[path]
Expand Down Expand Up @@ -77,7 +77,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
}

func (pathItem *PathItem) Operations() map[string]*Operation {
operations := make(map[string]*Operation, 8)
operations := make(map[string]*Operation)
if v := pathItem.Delete; v != nil {
operations[http.MethodDelete] = v
}
Expand Down
2 changes: 1 addition & 1 deletion openapi2conv/openapi2_conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ func stripNonCustomExtensions(extensions map[string]interface{}) {
func addPathExtensions(doc2 *openapi2.T, path string, extensionProps openapi3.ExtensionProps) {
paths := doc2.Paths
if paths == nil {
paths = make(map[string]*openapi2.PathItem, 8)
paths = make(map[string]*openapi2.PathItem)
doc2.Paths = paths
}
pathItem := paths[path]
Expand Down
2 changes: 1 addition & 1 deletion openapi3/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type Content map[string]*MediaType

func NewContent() Content {
return make(map[string]*MediaType, 4)
return make(map[string]*MediaType)
}

func NewContentWithSchema(schema *Schema, consumes []string) Content {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/path_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (pathItem *PathItem) UnmarshalJSON(data []byte) error {
}

func (pathItem *PathItem) Operations() map[string]*Operation {
operations := make(map[string]*Operation, 4)
operations := make(map[string]*Operation)
if v := pathItem.Connect; v != nil {
operations[http.MethodConnect] = v
}
Expand Down
2 changes: 1 addition & 1 deletion routers/legacy/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (router *Router) FindRoute(req *http.Request) (*routers.Route, map[string]s
Reason: routers.ErrPathNotFound.Error(),
}
}
pathParams = make(map[string]string, 8)
pathParams = make(map[string]string)
paramNames, err := server.ParameterNames()
if err != nil {
return nil, nil, err
Expand Down