From f9989f13b593b0aff01b26fcc03ccf65027d116b Mon Sep 17 00:00:00 2001 From: Pierre Fenoll Date: Fri, 26 Aug 2022 20:16:43 +0200 Subject: [PATCH] Use go1.19 formatting Signed-off-by: Pierre Fenoll --- jsoninfo/marshal.go | 4 ++-- jsoninfo/marshal_test.go | 7 ++++--- jsoninfo/unmarshal.go | 4 ++-- openapi3/errors.go | 6 +++--- openapi3/internalize_refs.go | 2 +- openapi3/paths.go | 8 ++++---- routers/legacy/pathpattern/node.go | 14 +++++++------- 7 files changed, 23 insertions(+), 22 deletions(-) diff --git a/jsoninfo/marshal.go b/jsoninfo/marshal.go index 2a98d68fb..6e946d877 100644 --- a/jsoninfo/marshal.go +++ b/jsoninfo/marshal.go @@ -7,8 +7,8 @@ import ( ) // MarshalStrictStruct function: -// * Marshals struct fields, ignoring MarshalJSON() and fields without 'json' tag. -// * Correctly handles StrictStruct semantics. +// - Marshals struct fields, ignoring MarshalJSON() and fields without 'json' tag. +// - Correctly handles StrictStruct semantics. func MarshalStrictStruct(value StrictStruct) ([]byte, error) { encoder := NewObjectEncoder() if err := value.EncodeWith(encoder, value); err != nil { diff --git a/jsoninfo/marshal_test.go b/jsoninfo/marshal_test.go index 05a6ac31b..10551542d 100644 --- a/jsoninfo/marshal_test.go +++ b/jsoninfo/marshal_test.go @@ -64,9 +64,10 @@ type EmbeddedType1 struct { } // Example describes expected outcome of: -// 1.Marshal JSON -// 2.Unmarshal value -// 3.Marshal value +// +// 1.Marshal JSON +// 2.Unmarshal value +// 3.Marshal value type Example struct { NoMarshal bool NoUnmarshal bool diff --git a/jsoninfo/unmarshal.go b/jsoninfo/unmarshal.go index ce3c337a3..eb6e758ac 100644 --- a/jsoninfo/unmarshal.go +++ b/jsoninfo/unmarshal.go @@ -7,8 +7,8 @@ import ( ) // UnmarshalStrictStruct function: -// * Unmarshals struct fields, ignoring UnmarshalJSON(...) and fields without 'json' tag. -// * Correctly handles StrictStruct +// - Unmarshals struct fields, ignoring UnmarshalJSON(...) and fields without 'json' tag. +// - Correctly handles StrictStruct func UnmarshalStrictStruct(data []byte, value StrictStruct) error { decoder, err := NewObjectDecoder(data) if err != nil { diff --git a/openapi3/errors.go b/openapi3/errors.go index ce52cd483..da0970abc 100644 --- a/openapi3/errors.go +++ b/openapi3/errors.go @@ -18,8 +18,8 @@ func (me MultiError) Error() string { return buff.String() } -//Is allows you to determine if a generic error is in fact a MultiError using `errors.Is()` -//It will also return true if any of the contained errors match target +// Is allows you to determine if a generic error is in fact a MultiError using `errors.Is()` +// It will also return true if any of the contained errors match target func (me MultiError) Is(target error) bool { if _, ok := target.(MultiError); ok { return true @@ -32,7 +32,7 @@ func (me MultiError) Is(target error) bool { return false } -//As allows you to use `errors.As()` to set target to the first error within the multi error that matches the target type +// As allows you to use `errors.As()` to set target to the first error within the multi error that matches the target type func (me MultiError) As(target interface{}) bool { for _, e := range me { if errors.As(e, target) { diff --git a/openapi3/internalize_refs.go b/openapi3/internalize_refs.go index 3a6cabb1a..3e19b79a2 100644 --- a/openapi3/internalize_refs.go +++ b/openapi3/internalize_refs.go @@ -322,7 +322,7 @@ func (doc *T) derefPaths(paths map[string]*PathItem, refNameResolver RefNameReso // // Example: // -// doc.InternalizeRefs(context.Background(), nil) +// doc.InternalizeRefs(context.Background(), nil) func (doc *T) InternalizeRefs(ctx context.Context, refNameResolver func(ref string) string) { if refNameResolver == nil { refNameResolver = DefaultRefNameResolver diff --git a/openapi3/paths.go b/openapi3/paths.go index b4ebe582a..be7f3dc42 100644 --- a/openapi3/paths.go +++ b/openapi3/paths.go @@ -98,10 +98,10 @@ func (paths Paths) Validate(ctx context.Context) error { // // For example: // -// paths := openapi3.Paths { -// "/person/{personName}": &openapi3.PathItem{}, -// } -// pathItem := path.Find("/person/{name}") +// paths := openapi3.Paths { +// "/person/{personName}": &openapi3.PathItem{}, +// } +// pathItem := path.Find("/person/{name}") // // would return the correct path item. func (paths Paths) Find(key string) *PathItem { diff --git a/routers/legacy/pathpattern/node.go b/routers/legacy/pathpattern/node.go index 862199864..011dda358 100644 --- a/routers/legacy/pathpattern/node.go +++ b/routers/legacy/pathpattern/node.go @@ -1,11 +1,11 @@ // Package pathpattern implements path matching. // // Examples of supported patterns: -// * "/" -// * "/abc"" -// * "/abc/{variable}" (matches until next '/' or end-of-string) -// * "/abc/{variable*}" (matches everything, including "/abc" if "/abc" has noot) -// * "/abc/{ variable | prefix_(.*}_suffix }" (matches regular expressions) +// - "/" +// - "/abc"" +// - "/abc/{variable}" (matches until next '/' or end-of-string) +// - "/abc/{variable*}" (matches everything, including "/abc" if "/abc" has noot) +// - "/abc/{ variable | prefix_(.*}_suffix }" (matches regular expressions) package pathpattern import ( @@ -28,8 +28,8 @@ type Options struct { // PathFromHost converts a host pattern to a path pattern. // // Examples: -// * PathFromHost("some-subdomain.domain.com", false) -> "com/./domain/./some-subdomain" -// * PathFromHost("some-subdomain.domain.com", true) -> "com/./domain/./subdomain/-/some" +// - PathFromHost("some-subdomain.domain.com", false) -> "com/./domain/./some-subdomain" +// - PathFromHost("some-subdomain.domain.com", true) -> "com/./domain/./subdomain/-/some" func PathFromHost(host string, specialDashes bool) string { buf := make([]byte, 0, len(host)) end := len(host)