build: upgrade to Go 1.18.1 (#373)

This commit is contained in:
Dane Strandboge
2022-04-13 15:50:35 -05:00
committed by GitHub
parent 30e64c5cc9
commit 35279515e9
11 changed files with 43 additions and 41 deletions

View File

@ -508,7 +508,7 @@ func detectContentType(body interface{}) string {
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
case reflect.Struct, reflect.Map, reflect.Pointer:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"

View File

@ -31,6 +31,7 @@ multiple locations.
* Use `strings.EqualFold` instead of comparing two `strings.ToLower` calls
* Update the `GenericOpenAPIError` type to enforce that error response models implement the `error` interface
* Update `setBody` to avoid buffering data in memory when the request body is already an `io.ReadCloser`
* Update reference from `reflect.Ptr` to `reflect.Pointer` as per the Go 1.18 spec
`configuration.mustache`
* Deleted `ContextOAuth2` key to match modification in client
@ -45,3 +46,4 @@ multiple locations.
`model_simple.mustache`
* Added `yaml:` tags to all model fields to support unmarshalling camelCase
* Added support for `x-go-field-type` vendor extension, to explicitly override the type generated for model fields
* Use `strings.Cut` when applicable over `strings.IndexByte` and slicing

View File

@ -492,7 +492,7 @@ func detectContentType(body interface{}) string {
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
case reflect.Struct, reflect.Map, reflect.Pointer:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"

View File

@ -325,12 +325,7 @@ return json.Marshal(toSerialize)
t := reflect{{{parent}}}.Type().Field(i)
if jsonTag := t.Tag.Get("json"); jsonTag != "" {
fieldName := ""
if commaIdx := strings.Index(jsonTag, ","); commaIdx > 0 {
fieldName = jsonTag[:commaIdx]
} else {
fieldName = jsonTag
}
fieldName, _, _ := strings.Cut(jsonTag, ",")
if fieldName != "AdditionalProperties" {
delete(additionalProperties, fieldName)
}