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

Use go1.19 formatting #584

Merged
merged 1 commit into from
Aug 26, 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
4 changes: 2 additions & 2 deletions jsoninfo/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions jsoninfo/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions jsoninfo/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions openapi3/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion openapi3/internalize_refs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions openapi3/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions routers/legacy/pathpattern/node.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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)
Expand Down