Skip to content

Commit

Permalink
Use go1.19 formatting (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
fenollp authored Aug 26, 2022
1 parent fd4bae8 commit 00d1ae8
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
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

0 comments on commit 00d1ae8

Please sign in to comment.