diff --git a/go.mod b/go.mod index b7948f0d..29d9bb9c 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/x448/float16 v0.8.4 // indirect golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.34.0 // indirect - golang.org/x/oauth2 v0.25.0 // indirect + golang.org/x/oauth2 v0.27.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/term v0.28.0 // indirect diff --git a/go.sum b/go.sum index 57d7046c..45b9bc70 100644 --- a/go.sum +++ b/go.sum @@ -234,8 +234,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= -golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= +golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/dario.cat/mergo/CODE_OF_CONDUCT.md b/vendor/dario.cat/mergo/CODE_OF_CONDUCT.md index 65987546..469b4490 100644 --- a/vendor/dario.cat/mergo/CODE_OF_CONDUCT.md +++ b/vendor/dario.cat/mergo/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/vendor/dario.cat/mergo/CONTRIBUTING.md b/vendor/dario.cat/mergo/CONTRIBUTING.md index e9d95170..0a1ff9f9 100644 --- a/vendor/dario.cat/mergo/CONTRIBUTING.md +++ b/vendor/dario.cat/mergo/CONTRIBUTING.md @@ -1,5 +1,4 @@ - # Contributing to mergo First off, thanks for taking the time to contribute! ❤️ @@ -7,14 +6,12 @@ First off, thanks for taking the time to contribute! ❤️ All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: -> > - Star the project > - Tweet about it > - Refer this project in your project's readme > - Mention the project at local meetups and tell your friends/colleagues - ## Table of Contents - [Code of Conduct](#code-of-conduct) @@ -30,6 +27,7 @@ This project and everyone participating in it is governed by the By participating, you are expected to uphold this code. Please report unacceptable behavior to <>. + ## I Have a Question > If you want to ask a question, we assume that you have read the available [Documentation](https://pkg.go.dev/github.com/imdario/mergo). @@ -47,13 +45,11 @@ We will then take care of the issue as soon as possible. ## I Want To Contribute > ### Legal Notice -> > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. ### Reporting Bugs - #### Before Submitting a Bug Report A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. @@ -70,18 +66,16 @@ A good bug report shouldn't leave others needing to chase you up for more inform - Can you reliably reproduce the issue? And can you also reproduce it with older versions? - #### How Do I Submit a Good Bug Report? > You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to . - We use GitHub issues to track bugs and errors. If you run into an issue with the project: - Open an [Issue](https://github.com/imdario/mergo/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) - Explain the behavior you would expect and the actual behavior. -- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. - Provide the information you collected in the previous section. Once it's filed: @@ -95,7 +89,6 @@ Once it's filed: This section guides you through submitting an enhancement suggestion for mergo, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. - #### Before Submitting an Enhancement - Make sure that you are using the latest version. @@ -104,7 +97,6 @@ This section guides you through submitting an enhancement suggestion for mergo, - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. - #### How Do I Submit a Good Enhancement Suggestion? Enhancement suggestions are tracked as [GitHub issues](https://github.com/imdario/mergo/issues). @@ -116,7 +108,5 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/imdari - **Explain why this enhancement would be useful** to most mergo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. - ## Attribution - This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! diff --git a/vendor/dario.cat/mergo/README.md b/vendor/dario.cat/mergo/README.md index d32d88f4..0b3c4888 100644 --- a/vendor/dario.cat/mergo/README.md +++ b/vendor/dario.cat/mergo/README.md @@ -66,7 +66,7 @@ Please keep in mind that a problematic PR broke [0.3.9](//github.com/imdario/mer Keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2), Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). I added an optional/variadic argument so that it won't break the existing code. -If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with `go get -u dario.cat/mergo`. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). +If you were using Mergo before April 6th, 2015, please check your project works as intended after updating your local copy with ```go get -u dario.cat/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause in existing projects after the change (release 0.2.0). ### Donations @@ -79,17 +79,17 @@ If Mergo is useful to you, consider buying me a coffee, a beer, or making a mont Mergo is used by [thousands](https://deps.dev/go/dario.cat%2Fmergo/v1.0.0/dependents) [of](https://deps.dev/go/github.com%2Fimdario%2Fmergo/v0.3.16/dependents) [projects](https://deps.dev/go/github.com%2Fimdario%2Fmergo/v0.3.12), including: -- [containerd/containerd](https://github.com/containerd/containerd) -- [datadog/datadog-agent](https://github.com/datadog/datadog-agent) -- [docker/cli/](https://github.com/docker/cli/) -- [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) -- [go-micro/go-micro](https://github.com/go-micro/go-micro) -- [grafana/loki](https://github.com/grafana/loki) -- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) -- [masterminds/sprig](github.com/Masterminds/sprig) -- [moby/moby](https://github.com/moby/moby) -- [slackhq/nebula](https://github.com/slackhq/nebula) -- [volcano-sh/volcano](https://github.com/volcano-sh/volcano) +* [containerd/containerd](https://github.com/containerd/containerd) +* [datadog/datadog-agent](https://github.com/datadog/datadog-agent) +* [docker/cli/](https://github.com/docker/cli/) +* [goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) +* [go-micro/go-micro](https://github.com/go-micro/go-micro) +* [grafana/loki](https://github.com/grafana/loki) +* [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) +* [masterminds/sprig](github.com/Masterminds/sprig) +* [moby/moby](https://github.com/moby/moby) +* [slackhq/nebula](https://github.com/slackhq/nebula) +* [volcano-sh/volcano](https://github.com/volcano-sh/volcano) ## Install diff --git a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md index b6f35642..5edd5a7c 100644 --- a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md +++ b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md @@ -2,7 +2,7 @@ ## [v3.11.0] - 2023-08-19 -- restored behavior as <= v3.9.0 with option to change path strategy using TrimRightSlashEnabled. +- restored behavior as <= v3.9.0 with option to change path strategy using TrimRightSlashEnabled. ## [v3.10.2] - 2023-03-09 - DO NOT USE @@ -27,10 +27,10 @@ ## [v3.8.0] - 2022-06-06 - use exact matching of allowed domain entries, issue #489 (#493) - - this changes fixes [security] Authorization Bypass Through User-Controlled Key - by changing the behaviour of the AllowedDomains setting in the CORS filter. - To support the previous behaviour, the CORS filter type now has a AllowedDomainFunc - callback mechanism which is called when a simple domain match fails. + - this changes fixes [security] Authorization Bypass Through User-Controlled Key + by changing the behaviour of the AllowedDomains setting in the CORS filter. + To support the previous behaviour, the CORS filter type now has a AllowedDomainFunc + callback mechanism which is called when a simple domain match fails. - add test and fix for POST without body and Content-type, issue #492 (#496) - [Minor] Bad practice to have a mix of Receiver types. (#491) @@ -38,6 +38,7 @@ - restored FilterChain (#482 by SVilgelm) + ## [v3.7.1] - 2021-10-04 - fix problem with contentEncodingEnabled setting (#479) @@ -72,6 +73,7 @@ - Fixed duplicate compression in dispatch. #449 + ## [v3.3.1] - 2020-08-31 - Added check on writer to prevent compression of response twice. #447 @@ -113,7 +115,7 @@ v2.11.1 - fix WriteError return value (#415) -v2.11.0 +v2.11.0 - allow prefix and suffix in path variable expression (#414) @@ -175,9 +177,9 @@ v2.6.0 - solved issue #304, make operation names unique 2017-01-30 - - [IMPORTANT] For swagger users, change your import statement to: - swagger "github.com/emicklei/go-restful-swagger12" + + [IMPORTANT] For swagger users, change your import statement to: + swagger "github.com/emicklei/go-restful-swagger12" - moved swagger 1.2 code to go-restful-swagger12 - created TAG 2.0.0 @@ -186,7 +188,7 @@ v2.6.0 - remove defer request body close - expose Dispatch for testing filters and Routefunctions -- swagger response model cannot be array +- swagger response model cannot be array - created TAG 1.0.0 2016-12-22 @@ -206,7 +208,7 @@ v2.6.0 2016-02-14 - take the qualify factor of the Accept header mediatype into account when deciding the contentype of the response -- add constructors for custom entity accessors for xml and json +- add constructors for custom entity accessors for xml and json 2015-09-27 @@ -259,7 +261,7 @@ v2.6.0 2014-10-31 - (api change) ReturnsError -> Returns -- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder +- (api add) RouteBuilder.Do(aBuilder) for DRY use of RouteBuilder - fix swagger nested structs - sort Swagger response messages by code @@ -269,7 +271,7 @@ v2.6.0 - fixed problem with greedy CurlyRouter - (api add) Access-Control-Max-Age in CORS - add tracing functionality (injectable) for debugging purposes -- support JSON parse 64bit int +- support JSON parse 64bit int - fix empty parameters for swagger - WebServicesUrl is now optional for swagger - fixed duplicate AccessControlAllowOrigin in CORS @@ -296,7 +298,7 @@ v2.6.0 2014-02-26 -- (api add) Request now provides information about the matched Route, see method SelectedRoutePath +- (api add) Request now provides information about the matched Route, see method SelectedRoutePath 2014-02-17 @@ -308,7 +310,7 @@ v2.6.0 2014-01-07 -- (api change) Write\* methods in Response now return the error or nil. +- (api change) Write* methods in Response now return the error or nil. - added example of serving HTML from a Go template. - fixed comparing Allowed headers in CORS (is now case-insensitive) @@ -331,9 +333,8 @@ v2.6.0 - Implemented CurlyRouter, a Router that does not use|allow regular expressions in paths 2013-08-05 - -- add OPTIONS support -- add CORS support + - add OPTIONS support + - add CORS support 2013-08-27 @@ -355,7 +356,8 @@ Important API changes: - (api remove) package variable DoNotRecover no longer works ; use restful.DefaultContainer.DoNotRecover(true) instead. - (api remove) package variable EnableContentEncoding no longer works ; use restful.DefaultContainer.EnableContentEncoding(true) instead. - + + 2013-07-06 - (api add) Added support for response encoding (gzip and deflate(zlib)). This feature is disabled on default (for backwards compatibility). Use restful.EnableContentEncoding = true in your initialization to enable this feature. @@ -374,18 +376,21 @@ Important API changes: - (optimize) Cache the RegExp compilation of Paths. 2013-05-22 - + - (api add) Added support for request/response filter functions 2013-05-18 + - (api add) Added feature to change the default Http Request Dispatch function (travis cline) - (api change) Moved Swagger Webservice to swagger package (see example restful-user) [2012-11-14 .. 2013-05-18> - + - See https://github.com/emicklei/go-restful/commits 2012-11-14 - Initial commit + + diff --git a/vendor/github.com/emicklei/go-restful/v3/README.md b/vendor/github.com/emicklei/go-restful/v3/README.md index e9f0cbfb..e3e30080 100644 --- a/vendor/github.com/emicklei/go-restful/v3/README.md +++ b/vendor/github.com/emicklei/go-restful/v3/README.md @@ -1,5 +1,5 @@ -# go-restful - +go-restful +========== package for building REST-style Web Services using Google Go [![Build Status](https://travis-ci.org/emicklei/go-restful.png)](https://travis-ci.org/emicklei/go-restful) @@ -18,7 +18,7 @@ REST asks developers to use HTTP methods explicitly and in a way that's consiste - DELETE = Delete if you are requesting the server to delete the resource - PATCH = Update partial content of a resource - OPTIONS = Get information about the communication options for the request URI - + ### Usage #### Without Go Modules @@ -53,23 +53,23 @@ ws. ws.Route(ws.GET("/{user-id}").To(u.findUser). Doc("get a user"). Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")). - Writes(User{})) + Writes(User{})) ... - + func (u UserResource) findUser(request *restful.Request, response *restful.Response) { id := request.PathParameter("user-id") ... } ``` - -[Full API of a UserResource](https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go) - + +[Full API of a UserResource](https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go) + ### Features -- Routes for request → function mapping with path parameter (e.g. {id} but also prefix\_{var} and {var}\_suffix) support +- Routes for request → function mapping with path parameter (e.g. {id} but also prefix_{var} and {var}_suffix) support - Configurable router: - - (default) Fast routing algorithm that allows static elements, [google custom method](https://cloud.google.com/apis/design/custom_methods), regular expressions and dynamic parameters in the URL path (e.g. /resource/name:customVerb, /meetings/{id} or /static/{subpath:\*}) - - Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions + - (default) Fast routing algorithm that allows static elements, [google custom method](https://cloud.google.com/apis/design/custom_methods), regular expressions and dynamic parameters in the URL path (e.g. /resource/name:customVerb, /meetings/{id} or /static/{subpath:*}) + - Routing algorithm after [JSR311](http://jsr311.java.net/nonav/releases/1.1/spec/spec.html) that is implemented using (but does **not** accept) regular expressions - Request API for reading structs from JSON/XML and accessing parameters (path,query,header) - Response API for writing structs to JSON/XML and setting headers - Customizable encoding using EntityReaderWriter registration @@ -87,7 +87,6 @@ func (u UserResource) findUser(request *restful.Request, response *restful.Respo - Inject your own http.Handler using the `HttpMiddlewareHandlerToFilter` function ## How to customize - There are several hooks to customize the behavior of the go-restful package. - Router algorithm @@ -96,8 +95,8 @@ There are several hooks to customize the behavior of the go-restful package. - Trace logging - Compression - Encoders for other serializers -- Use [jsoniter](https://github.com/json-iterator/go) by building this package using a build tag, e.g. `go build -tags=jsoniter .` -- Use the package variable `TrimRightSlashEnabled` (default true) to control the behavior of matching routes that end with a slash `/` +- Use [jsoniter](https://github.com/json-iterator/go) by building this package using a build tag, e.g. `go build -tags=jsoniter .` +- Use the package variable `TrimRightSlashEnabled` (default true) to control the behavior of matching routes that end with a slash `/` ## Resources @@ -108,6 +107,6 @@ There are several hooks to customize the behavior of the go-restful package. - [showcase: Zazkia - tcp proxy for testing resiliency](https://github.com/emicklei/zazkia) - [showcase: Mora - MongoDB REST Api server](https://github.com/emicklei/mora) -Type `git shortlog -s` for a full list of contributors. +Type ```git shortlog -s``` for a full list of contributors. © 2012 - 2023, http://ernestmicklei.com. MIT License. Contributions are welcome. diff --git a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md b/vendor/github.com/emicklei/go-restful/v3/SECURITY.md index 2adfba8b..810d3b51 100644 --- a/vendor/github.com/emicklei/go-restful/v3/SECURITY.md +++ b/vendor/github.com/emicklei/go-restful/v3/SECURITY.md @@ -2,10 +2,10 @@ ## Supported Versions -| Version | Supported | -| -------- | ------------------ | -| v3.7.x | :white_check_mark: | -| < v3.0.1 | :x: | +| Version | Supported | +| ------- | ------------------ | +| v3.7.x | :white_check_mark: | +| < v3.0.1 | :x: | ## Reporting a Vulnerability diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md index f330c618..be82827c 100644 --- a/vendor/github.com/fatih/color/README.md +++ b/vendor/github.com/fatih/color/README.md @@ -124,8 +124,8 @@ fmt.Println("All text will now be bold magenta.") ### Disable/Enable color -There might be a case where you want to explicitly disable/enable color output. the -`go-isatty` package will automatically disable color output for non-tty output streams +There might be a case where you want to explicitly disable/enable color output. the +`go-isatty` package will automatically disable color output for non-tty output streams (for example if the output were piped directly to `less`). The `color` package also disables color output if the [`NO_COLOR`](https://no-color.org) environment @@ -159,17 +159,17 @@ c.Println("This prints again cyan...") ## GitHub Actions -To output color in GitHub Actions (or other CI systems that support ANSI colors), make sure to set `color.NoColor = false` so that it bypasses the check for non-tty output streams. +To output color in GitHub Actions (or other CI systems that support ANSI colors), make sure to set `color.NoColor = false` so that it bypasses the check for non-tty output streams. ## Todo -- Save/Return previous values -- Evaluate fmt.Formatter interface +* Save/Return previous values +* Evaluate fmt.Formatter interface ## Credits -- [Fatih Arslan](https://github.com/fatih) -- Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable) +* [Fatih Arslan](https://github.com/fatih) +* Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable) ## License diff --git a/vendor/github.com/go-json-experiment/json/README.md b/vendor/github.com/go-json-experiment/json/README.md index d1f1cac7..243e2af4 100644 --- a/vendor/github.com/go-json-experiment/json/README.md +++ b/vendor/github.com/go-json-experiment/json/README.md @@ -16,45 +16,45 @@ A [Discussion about including this package in Go as `encoding/json/v2`](https:// ## Goals and objectives -- **Mostly backwards compatible:** If possible, v2 should aim to be _mostly_ - compatible with v1 in terms of both API and default behavior to ease migration. - For example, the `Marshal` and `Unmarshal` functions are the most widely used - declarations in the v1 package. It seems sensible for equivalent functionality - in v2 to be named the same and have a mostly compatible signature. - Behaviorally, we should aim for 95% to 99% backwards compatibility. - We do not aim for 100% compatibility since we want the freedom to break - certain behaviors that are now considered to have been a mistake. - We may provide options that can bring the v2 implementation to 100% compatibility, - but it will not be the default. - -- **More flexible:** There is a - [long list of feature requests](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle). - We should aim to provide the most flexible features that addresses most usages. - We do not want to over fit the v2 API to handle every possible use case. - Ideally, the features provided should be orthogonal in nature such that - any combination of features results in as few surprising edge cases as possible. - -- **More performant:** JSON serialization is widely used and any bit of extra - performance gains will be greatly appreciated. Some rarely used behaviors of v1 - may be dropped in favor of better performance. For example, - despite `Encoder` and `Decoder` operating on an `io.Writer` and `io.Reader`, - they do not operate in a truly streaming manner, - leading to a loss in performance. The v2 implementation should aim to be truly - streaming by default (see [#33714](https://golang.org/issue/33714)). - -- **Easy to use (hard to misuse):** The v2 API should aim to make - the common case easy and the less common case at least possible. - The API should avoid behavior that goes contrary to user expectation, - which may result in subtle bugs (see [#36225](https://golang.org/issue/36225)). - -- **v1 and v2 maintainability:** Since the v1 implementation must stay forever, - it would be beneficial if v1 could be implemented under the hood with v2, - allowing for less maintenance burden in the future. This probably implies that - behavioral changes in v2 relative to v1 need to be exposed as options. - -- **Avoid unsafe:** Standard library packages generally avoid the use of - package `unsafe` even if it could provide a performance boost. - We aim to preserve this property. +* **Mostly backwards compatible:** If possible, v2 should aim to be _mostly_ +compatible with v1 in terms of both API and default behavior to ease migration. +For example, the `Marshal` and `Unmarshal` functions are the most widely used +declarations in the v1 package. It seems sensible for equivalent functionality +in v2 to be named the same and have a mostly compatible signature. +Behaviorally, we should aim for 95% to 99% backwards compatibility. +We do not aim for 100% compatibility since we want the freedom to break +certain behaviors that are now considered to have been a mistake. +We may provide options that can bring the v2 implementation to 100% compatibility, +but it will not be the default. + +* **More flexible:** There is a +[long list of feature requests](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle). +We should aim to provide the most flexible features that addresses most usages. +We do not want to over fit the v2 API to handle every possible use case. +Ideally, the features provided should be orthogonal in nature such that +any combination of features results in as few surprising edge cases as possible. + +* **More performant:** JSON serialization is widely used and any bit of extra +performance gains will be greatly appreciated. Some rarely used behaviors of v1 +may be dropped in favor of better performance. For example, +despite `Encoder` and `Decoder` operating on an `io.Writer` and `io.Reader`, +they do not operate in a truly streaming manner, +leading to a loss in performance. The v2 implementation should aim to be truly +streaming by default (see [#33714](https://golang.org/issue/33714)). + +* **Easy to use (hard to misuse):** The v2 API should aim to make +the common case easy and the less common case at least possible. +The API should avoid behavior that goes contrary to user expectation, +which may result in subtle bugs (see [#36225](https://golang.org/issue/36225)). + +* **v1 and v2 maintainability:** Since the v1 implementation must stay forever, +it would be beneficial if v1 could be implemented under the hood with v2, +allowing for less maintenance burden in the future. This probably implies that +behavioral changes in v2 relative to v1 need to be exposed as options. + +* **Avoid unsafe:** Standard library packages generally avoid the use of +package `unsafe` even if it could provide a performance boost. +We aim to preserve this property. ## Expectations @@ -66,16 +66,15 @@ At the present moment, this is still in the design and experimentation phase and is not ready for a formal proposal. There are several possible outcomes from this experiment: - 1. We determine that a v2 `encoding/json` would not provide sufficient benefit - over the existing v1 `encoding/json` package. Thus, we abandon this effort. +over the existing v1 `encoding/json` package. Thus, we abandon this effort. 2. We propose a v2 `encoding/json` design, but it is rejected in favor of some - other design that is considered superior. +other design that is considered superior. 3. We propose a v2 `encoding/json` design, but rather than adding an entirely - new v2 `encoding/json` package, we decide to merge its functionality into - the existing v1 `encoding/json` package. +new v2 `encoding/json` package, we decide to merge its functionality into +the existing v1 `encoding/json` package. 4. We propose a v2 `encoding/json` design and it is accepted, resulting in - its addition to the standard library. +its addition to the standard library. 5. Some other unforeseen outcome (among the infinite number of possibilities). ## Development @@ -140,30 +139,30 @@ behavior similar to what v1 provided. This table shows an overview of the changes: -| v1 | v2 | Details | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -| JSON object members are unmarshaled into a Go struct using a **case-insensitive name match**. | JSON object members are unmarshaled into a Go struct using a **case-sensitive name match**. | [CaseSensitivity](/diff_test.go#:~:text=TestCaseSensitivity) | -| When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value is an empty Go value**, which is defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string. | When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value would encode as an empty JSON value**, which is defined as a JSON null, or an empty JSON string, object, or array. | [OmitEmptyOption](/diff_test.go#:~:text=TestOmitEmptyOption) | -| The `string` option **does affect** Go bools. | The `string` option **does not affect** Go bools. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| The `string` option **does not recursively affect** sub-values of the Go field value. | The `string` option **does recursively affect** sub-values of the Go field value. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| The `string` option **sometimes accepts** a JSON null escaped within a JSON string. | The `string` option **never accepts** a JSON null escaped within a JSON string. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| A nil Go slice is marshaled as a **JSON null**. | A nil Go slice is marshaled as an **empty JSON array**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | -| A nil Go map is marshaled as a **JSON null**. | A nil Go map is marshaled as an **empty JSON object**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | -| A Go array may be unmarshaled from a **JSON array of any length**. | A Go array must be unmarshaled from a **JSON array of the same length**. | [Arrays](/diff_test.go#:~:text=Arrays) | -| A Go byte array is represented as a **JSON array of JSON numbers**. | A Go byte array is represented as a **Base64-encoded JSON string**. | [ByteArrays](/diff_test.go#:~:text=TestByteArrays) | -| `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **inconsistently called**. | `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **consistently called**. | [PointerReceiver](/diff_test.go#:~:text=TestPointerReceiver) | -| A Go map is marshaled in a **deterministic order**. | A Go map is marshaled in a **non-deterministic order**. | [MapDeterminism](/diff_test.go#:~:text=TestMapDeterminism) | -| JSON strings are encoded **with HTML-specific characters being escaped**. | JSON strings are encoded **without any characters being escaped** (unless necessary). | [EscapeHTML](/diff_test.go#:~:text=TestEscapeHTML) | -| When marshaling, invalid UTF-8 within a Go string **are silently replaced**. | When marshaling, invalid UTF-8 within a Go string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | -| When unmarshaling, invalid UTF-8 within a JSON string **are silently replaced**. | When unmarshaling, invalid UTF-8 within a JSON string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | -| When marshaling, **an error does not occur** if the output JSON value contains objects with duplicate names. | When marshaling, **an error does occur** if the output JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | -| When unmarshaling, **an error does not occur** if the input JSON value contains objects with duplicate names. | When unmarshaling, **an error does occur** if the input JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | -| Unmarshaling a JSON null into a non-empty Go value **inconsistently clears the value or does nothing**. | Unmarshaling a JSON null into a non-empty Go value **always clears the value**. | [MergeNull](/diff_test.go#:~:text=TestMergeNull) | -| Unmarshaling a JSON value into a non-empty Go value **follows inconsistent and bizarre behavior**. | Unmarshaling a JSON value into a non-empty Go value **always merges if the input is an object, and otherwise replaces**. | [MergeComposite](/diff_test.go#:~:text=TestMergeComposite) | -| A `time.Duration` is represented as a **JSON number containing the decimal number of nanoseconds**. | A `time.Duration` is represented as a **JSON string containing the formatted duration (e.g., "1h2m3.456s")**. | [TimeDurations](/diff_test.go#:~:text=TestTimeDurations) | -| Unmarshaling a JSON number into a Go float beyond its representation **results in an error**. | Unmarshaling a JSON number into a Go float beyond its representation **uses the closest representable value (e.g., ±`math.MaxFloat`)**. | [MaxFloats](/diff_test.go#:~:text=TestMaxFloats) | -| A Go struct with only unexported fields **can be serialized**. | A Go struct with only unexported fields **cannot be serialized**. | [EmptyStructs](/diff_test.go#:~:text=TestEmptyStructs) | -| A Go struct that embeds an unexported struct type **can sometimes be serialized**. | A Go struct that embeds an unexported struct type **cannot be serialized**. | [EmbedUnexported](/diff_test.go#:~:text=TestEmbedUnexported) | +| v1 | v2 | Details | +| -- | -- | ------- | +| JSON object members are unmarshaled into a Go struct using a **case-insensitive name match**. | JSON object members are unmarshaled into a Go struct using a **case-sensitive name match**. | [CaseSensitivity](/diff_test.go#:~:text=TestCaseSensitivity) | +| When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value is an empty Go value**, which is defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string. | When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value would encode as an empty JSON value**, which is defined as a JSON null, or an empty JSON string, object, or array. | [OmitEmptyOption](/diff_test.go#:~:text=TestOmitEmptyOption) | +| The `string` option **does affect** Go bools. | The `string` option **does not affect** Go bools. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| The `string` option **does not recursively affect** sub-values of the Go field value. | The `string` option **does recursively affect** sub-values of the Go field value. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| The `string` option **sometimes accepts** a JSON null escaped within a JSON string. | The `string` option **never accepts** a JSON null escaped within a JSON string. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| A nil Go slice is marshaled as a **JSON null**. | A nil Go slice is marshaled as an **empty JSON array**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | +| A nil Go map is marshaled as a **JSON null**. | A nil Go map is marshaled as an **empty JSON object**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | +| A Go array may be unmarshaled from a **JSON array of any length**. | A Go array must be unmarshaled from a **JSON array of the same length**. | [Arrays](/diff_test.go#:~:text=Arrays) | +| A Go byte array is represented as a **JSON array of JSON numbers**. | A Go byte array is represented as a **Base64-encoded JSON string**. | [ByteArrays](/diff_test.go#:~:text=TestByteArrays) | +| `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **inconsistently called**. | `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **consistently called**. | [PointerReceiver](/diff_test.go#:~:text=TestPointerReceiver) | +| A Go map is marshaled in a **deterministic order**. | A Go map is marshaled in a **non-deterministic order**. | [MapDeterminism](/diff_test.go#:~:text=TestMapDeterminism) | +| JSON strings are encoded **with HTML-specific characters being escaped**. | JSON strings are encoded **without any characters being escaped** (unless necessary). | [EscapeHTML](/diff_test.go#:~:text=TestEscapeHTML) | +| When marshaling, invalid UTF-8 within a Go string **are silently replaced**. | When marshaling, invalid UTF-8 within a Go string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | +| When unmarshaling, invalid UTF-8 within a JSON string **are silently replaced**. | When unmarshaling, invalid UTF-8 within a JSON string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | +| When marshaling, **an error does not occur** if the output JSON value contains objects with duplicate names. | When marshaling, **an error does occur** if the output JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | +| When unmarshaling, **an error does not occur** if the input JSON value contains objects with duplicate names. | When unmarshaling, **an error does occur** if the input JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | +| Unmarshaling a JSON null into a non-empty Go value **inconsistently clears the value or does nothing**. | Unmarshaling a JSON null into a non-empty Go value **always clears the value**. | [MergeNull](/diff_test.go#:~:text=TestMergeNull) | +| Unmarshaling a JSON value into a non-empty Go value **follows inconsistent and bizarre behavior**. | Unmarshaling a JSON value into a non-empty Go value **always merges if the input is an object, and otherwise replaces**. | [MergeComposite](/diff_test.go#:~:text=TestMergeComposite) | +| A `time.Duration` is represented as a **JSON number containing the decimal number of nanoseconds**. | A `time.Duration` is represented as a **JSON string containing the formatted duration (e.g., "1h2m3.456s")**. | [TimeDurations](/diff_test.go#:~:text=TestTimeDurations) | +| Unmarshaling a JSON number into a Go float beyond its representation **results in an error**. | Unmarshaling a JSON number into a Go float beyond its representation **uses the closest representable value (e.g., ±`math.MaxFloat`)**. | [MaxFloats](/diff_test.go#:~:text=TestMaxFloats) | +| A Go struct with only unexported fields **can be serialized**. | A Go struct with only unexported fields **cannot be serialized**. | [EmptyStructs](/diff_test.go#:~:text=TestEmptyStructs) | +| A Go struct that embeds an unexported struct type **can sometimes be serialized**. | A Go struct that embeds an unexported struct type **cannot be serialized**. | [EmbedUnexported](/diff_test.go#:~:text=TestEmbedUnexported) | See [diff_test.go](/diff_test.go) for details about every change. diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md index 904e0c86..9322b065 100644 --- a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md +++ b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md @@ -14,21 +14,21 @@ orientation. Examples of behavior that contributes to creating a positive environment include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a +* Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md index 32051b21..0108f1d5 100644 --- a/vendor/github.com/go-openapi/jsonpointer/README.md +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -8,15 +8,12 @@ An implementation of JSON Pointer - Go language ## Status - Completed YES Tested YES ## References - http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 ### Note - The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented. diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md index 904e0c86..9322b065 100644 --- a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md +++ b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md @@ -14,21 +14,21 @@ orientation. Examples of behavior that contributes to creating a positive environment include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a +* Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md index 799c3feb..b94753aa 100644 --- a/vendor/github.com/go-openapi/jsonreference/README.md +++ b/vendor/github.com/go-openapi/jsonreference/README.md @@ -4,15 +4,12 @@ An implementation of JSON Reference - Go language ## Status - Feature complete. Stable API ## Dependencies - https://github.com/go-openapi/jsonpointer ## References - http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 diff --git a/vendor/github.com/go-openapi/swag/BENCHMARK.md b/vendor/github.com/go-openapi/swag/BENCHMARK.md index 3fa25c33..e7f28ed6 100644 --- a/vendor/github.com/go-openapi/swag/BENCHMARK.md +++ b/vendor/github.com/go-openapi/swag/BENCHMARK.md @@ -42,7 +42,7 @@ BenchmarkToXXXName/ToHumanNameTitle-4 9188260 3941 ns/op 104 B/op goos: linux goarch: amd64 pkg: github.com/go-openapi/swag -cpu: AMD Ryzen 7 5800X 8-Core Processor +cpu: AMD Ryzen 7 5800X 8-Core Processor BenchmarkToXXXName/ToGoName-16 18527378 1972 ns/op 42 B/op 5 allocs/op BenchmarkToXXXName/ToVarName-16 15552692 2093 ns/op 62 B/op 7 allocs/op BenchmarkToXXXName/ToFileName-16 32161176 1117 ns/op 147 B/op 7 allocs/op diff --git a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md index 904e0c86..9322b065 100644 --- a/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md +++ b/vendor/github.com/go-openapi/swag/CODE_OF_CONDUCT.md @@ -14,21 +14,21 @@ orientation. Examples of behavior that contributes to creating a positive environment include: -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members Examples of unacceptable behavior by participants include: -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a +* Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/vendor/github.com/go-openapi/swag/README.md b/vendor/github.com/go-openapi/swag/README.md index 22606ec3..a7292229 100644 --- a/vendor/github.com/go-openapi/swag/README.md +++ b/vendor/github.com/go-openapi/swag/README.md @@ -9,14 +9,15 @@ Contains a bunch of helper functions for go-openapi and go-swagger projects. You may also use it standalone for your projects. -- convert between value and pointers for builtin types -- convert from string to builtin types (wraps strconv) -- fast json concatenation -- search in path -- load from file or http -- name mangling +* convert between value and pointers for builtin types +* convert from string to builtin types (wraps strconv) +* fast json concatenation +* search in path +* load from file or http +* name mangling + This repo has only few dependencies outside of the standard library: -- YAML utilities depend on `gopkg.in/yaml.v3` -- `github.com/mailru/easyjson v0.7.7` +* YAML utilities depend on `gopkg.in/yaml.v3` +* `github.com/mailru/easyjson v0.7.7` diff --git a/vendor/github.com/gobuffalo/flect/.gometalinter.json b/vendor/github.com/gobuffalo/flect/.gometalinter.json index c8da5a91..e4f65a36 100644 --- a/vendor/github.com/gobuffalo/flect/.gometalinter.json +++ b/vendor/github.com/gobuffalo/flect/.gometalinter.json @@ -1,15 +1,3 @@ { - "Enable": [ - "vet", - "golint", - "goimports", - "deadcode", - "gotype", - "ineffassign", - "misspell", - "nakedret", - "unconvert", - "megacheck", - "varcheck" - ] + "Enable": ["vet", "golint", "goimports", "deadcode", "gotype", "ineffassign", "misspell", "nakedret", "unconvert", "megacheck", "varcheck"] } diff --git a/vendor/github.com/gobuffalo/flect/README.md b/vendor/github.com/gobuffalo/flect/README.md index d5bf36f7..14547e22 100644 --- a/vendor/github.com/gobuffalo/flect/README.md +++ b/vendor/github.com/gobuffalo/flect/README.md @@ -16,22 +16,22 @@ With this reason along with the main purpose of Flect, which is to make it easy to develop web application in Go, Flect has limitations with its own rules. -- It covers regular rule (adding -s or -es and of the word) -- It covers well-known irregular rules (such as -is to -es, -f to -ves, etc) - - https://en.wiktionary.org/wiki/Appendix:English_irregular_nouns#Rules -- It covers well-known irregular words (such as children, men, etc) -- If a word can be countable and uncountable like milk or time, it will be +* It covers regular rule (adding -s or -es and of the word) +* It covers well-known irregular rules (such as -is to -es, -f to -ves, etc) + * https://en.wiktionary.org/wiki/Appendix:English_irregular_nouns#Rules +* It covers well-known irregular words (such as children, men, etc) +* If a word can be countable and uncountable like milk or time, it will be treated as countable. -- If a word has more than one plural forms, which means it has at least one +* If a word has more than one plural forms, which means it has at least one irregular plural, we tried to find most popular one. (The selected plural could be odd to you, please feel free to open an issue with back data) - - For example, we selected "stadiums" over "stadia", "dwarfs" over "dwarves" - - One or combination of en.wiktionary.org, britannica.com, and + * For example, we selected "stadiums" over "stadia", "dwarfs" over "dwarves" + * One or combination of en.wiktionary.org, britannica.com, and trends.google.com are used to check the recent usage trends. -- However, we cannot cover all cases and some of our cases could not fit with +* However, we cannot cover all cases and some of our cases could not fit with your situation. You can override the default with functions such as `InsertPlural()`, `InsertSingular()`, or `LoadInfrections()`. -- If you have a json file named `inflections.json` in your application root, +* If you have a json file named `inflections.json` in your application root, the file will be automatically loaded as your custom inflection dictionary. ## Installation @@ -40,6 +40,7 @@ rules. $ go get github.com/gobuffalo/flect ``` + ## Packages ### `github.com/gobuffalo/flect` @@ -52,8 +53,8 @@ In addition to helpful methods that take in a `string` and return a `string`, th The `Ident` type contains two fields. -- `Original` - This is the original `string` that was used to create the `Ident` -- `Parts` - This is a `[]string` that represents all of the "parts" of the string, that have been split apart, making the segments easier to work with +* `Original` - This is the original `string` that was used to create the `Ident` +* `Parts` - This is a `[]string` that represents all of the "parts" of the string, that have been split apart, making the segments easier to work with Examples of creating new inflection rules using `Ident` can be found in the `github.com/gobuffalo/flect/name` package. diff --git a/vendor/github.com/gobuffalo/flect/SHOULDERS.md b/vendor/github.com/gobuffalo/flect/SHOULDERS.md index 1f0bb3e4..75222c6b 100644 --- a/vendor/github.com/gobuffalo/flect/SHOULDERS.md +++ b/vendor/github.com/gobuffalo/flect/SHOULDERS.md @@ -4,9 +4,9 @@ Flect does not try to reinvent the wheel! Instead, it uses the already great whe Thank you to the following **GIANTS**: -- [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) -- [github.com/pmezard/go-difflib](https://godoc.org/github.com/pmezard/go-difflib) -- [github.com/stretchr/objx](https://godoc.org/github.com/stretchr/objx) -- [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) -- [gopkg.in/check.v1](https://godoc.org/gopkg.in/check.v1) -- [gopkg.in/yaml.v3](https://godoc.org/gopkg.in/yaml.v3) +* [github.com/davecgh/go-spew](https://godoc.org/github.com/davecgh/go-spew) +* [github.com/pmezard/go-difflib](https://godoc.org/github.com/pmezard/go-difflib) +* [github.com/stretchr/objx](https://godoc.org/github.com/stretchr/objx) +* [github.com/stretchr/testify](https://godoc.org/github.com/stretchr/testify) +* [gopkg.in/check.v1](https://godoc.org/gopkg.in/check.v1) +* [gopkg.in/yaml.v3](https://godoc.org/gopkg.in/yaml.v3) diff --git a/vendor/github.com/google/gnostic-models/jsonschema/schema.json b/vendor/github.com/google/gnostic-models/jsonschema/schema.json index 545e9fd9..85eb502a 100644 --- a/vendor/github.com/google/gnostic-models/jsonschema/schema.json +++ b/vendor/github.com/google/gnostic-models/jsonschema/schema.json @@ -1,138 +1,150 @@ { - "id": "http://json-schema.org/draft-04/schema#", - "$schema": "http://json-schema.org/draft-04/schema#", - "description": "Core schema meta-schema", - "definitions": { - "schemaArray": { - "type": "array", - "minItems": 1, - "items": { "$ref": "#" } - }, - "positiveInteger": { - "type": "integer", - "minimum": 0 - }, - "positiveIntegerDefault0": { - "allOf": [{ "$ref": "#/definitions/positiveInteger" }, { "default": 0 }] - }, - "simpleTypes": { - "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] - }, - "stringArray": { - "type": "array", - "items": { "type": "string" }, - "minItems": 1, - "uniqueItems": true - } - }, - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uri" - }, - "$schema": { - "type": "string", - "format": "uri" - }, - "title": { - "type": "string" - }, - "description": { - "type": "string" - }, - "default": {}, - "multipleOf": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - }, - "maximum": { - "type": "number" - }, - "exclusiveMaximum": { - "type": "boolean", - "default": false - }, - "minimum": { - "type": "number" - }, - "exclusiveMinimum": { - "type": "boolean", - "default": false - }, - "maxLength": { "$ref": "#/definitions/positiveInteger" }, - "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "pattern": { - "type": "string", - "format": "regex" - }, - "additionalItems": { - "anyOf": [{ "type": "boolean" }, { "$ref": "#" }], - "default": {} - }, - "items": { - "anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/schemaArray" }], - "default": {} - }, - "maxItems": { "$ref": "#/definitions/positiveInteger" }, - "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "uniqueItems": { - "type": "boolean", - "default": false - }, - "maxProperties": { "$ref": "#/definitions/positiveInteger" }, - "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, - "required": { "$ref": "#/definitions/stringArray" }, - "additionalProperties": { - "anyOf": [{ "type": "boolean" }, { "$ref": "#" }], - "default": {} - }, + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", "definitions": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } }, + "type": "object", "properties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} - }, - "patternProperties": { - "type": "object", - "additionalProperties": { "$ref": "#" }, - "default": {} + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } }, "dependencies": { - "type": "object", - "additionalProperties": { - "anyOf": [{ "$ref": "#" }, { "$ref": "#/definitions/stringArray" }] - } - }, - "enum": { - "type": "array", - "minItems": 1, - "uniqueItems": true - }, - "type": { - "anyOf": [ - { "$ref": "#/definitions/simpleTypes" }, - { - "type": "array", - "items": { "$ref": "#/definitions/simpleTypes" }, - "minItems": 1, - "uniqueItems": true - } - ] + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] }, - "allOf": { "$ref": "#/definitions/schemaArray" }, - "anyOf": { "$ref": "#/definitions/schemaArray" }, - "oneOf": { "$ref": "#/definitions/schemaArray" }, - "not": { "$ref": "#" } - }, - "dependencies": { - "exclusiveMaximum": ["maximum"], - "exclusiveMinimum": ["minimum"] - }, - "default": {} + "default": {} } diff --git a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json index 1510a331..afa12b79 100644 --- a/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json +++ b/vendor/github.com/google/gnostic-models/openapiv2/openapi-2.0.json @@ -3,7 +3,11 @@ "id": "http://swagger.io/v2/schema.json#", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", - "required": ["swagger", "info", "paths"], + "required": [ + "swagger", + "info", + "paths" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -13,7 +17,9 @@ "properties": { "swagger": { "type": "string", - "enum": ["2.0"], + "enum": [ + "2.0" + ], "description": "The Swagger version of this document." }, "info": { @@ -81,7 +87,10 @@ "info": { "type": "object", "description": "General information about the API.", - "required": ["version", "title"], + "required": [ + "version", + "title" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -141,7 +150,9 @@ }, "license": { "type": "object", - "required": ["name"], + "required": [ + "name" + ], "additionalProperties": false, "properties": { "name": { @@ -198,7 +209,9 @@ "type": "object", "additionalProperties": false, "description": "information about external documentation", - "required": ["url"], + "required": [ + "url" + ], "properties": { "description": { "type": "string" @@ -224,7 +237,9 @@ }, "operation": { "type": "object", - "required": ["responses"], + "required": [ + "responses" + ], "additionalProperties": false, "patternProperties": { "^x-": { @@ -361,7 +376,9 @@ }, "response": { "type": "object", - "required": ["description"], + "required": [ + "description" + ], "properties": { "description": { "type": "string" @@ -399,11 +416,19 @@ "header": { "type": "object", "additionalProperties": false, - "required": ["type"], + "required": [ + "type" + ], "properties": { "type": { "type": "string", - "enum": ["string", "number", "integer", "boolean", "array"] + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] }, "format": { "type": "string" @@ -470,7 +495,11 @@ }, "bodyParameter": { "type": "object", - "required": ["name", "in", "schema"], + "required": [ + "name", + "in", + "schema" + ], "patternProperties": { "^x-": { "$ref": "#/definitions/vendorExtension" @@ -488,7 +517,9 @@ "in": { "type": "string", "description": "Determines the location of the parameter.", - "enum": ["body"] + "enum": [ + "body" + ] }, "required": { "type": "boolean", @@ -517,7 +548,9 @@ "in": { "type": "string", "description": "Determines the location of the parameter.", - "enum": ["header"] + "enum": [ + "header" + ] }, "description": { "type": "string", @@ -529,7 +562,13 @@ }, "type": { "type": "string", - "enum": ["string", "number", "boolean", "integer", "array"] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] }, "format": { "type": "string" @@ -597,7 +636,9 @@ "in": { "type": "string", "description": "Determines the location of the parameter.", - "enum": ["query"] + "enum": [ + "query" + ] }, "description": { "type": "string", @@ -614,7 +655,13 @@ }, "type": { "type": "string", - "enum": ["string", "number", "boolean", "integer", "array"] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] }, "format": { "type": "string" @@ -682,7 +729,9 @@ "in": { "type": "string", "description": "Determines the location of the parameter.", - "enum": ["formData"] + "enum": [ + "formData" + ] }, "description": { "type": "string", @@ -699,7 +748,14 @@ }, "type": { "type": "string", - "enum": ["string", "number", "boolean", "integer", "array", "file"] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array", + "file" + ] }, "format": { "type": "string" @@ -758,17 +814,23 @@ "$ref": "#/definitions/vendorExtension" } }, - "required": ["required"], + "required": [ + "required" + ], "properties": { "required": { "type": "boolean", - "enum": [true], + "enum": [ + true + ], "description": "Determines whether or not this parameter is required or optional." }, "in": { "type": "string", "description": "Determines the location of the parameter.", - "enum": ["path"] + "enum": [ + "path" + ] }, "description": { "type": "string", @@ -780,7 +842,13 @@ }, "type": { "type": "string", - "enum": ["string", "number", "boolean", "integer", "array"] + "enum": [ + "string", + "number", + "boolean", + "integer", + "array" + ] }, "format": { "type": "string" @@ -834,7 +902,11 @@ }, "nonBodyParameter": { "type": "object", - "required": ["name", "in", "type"], + "required": [ + "name", + "in", + "type" + ], "oneOf": [ { "$ref": "#/definitions/headerParameterSubSchema" @@ -997,7 +1069,9 @@ "$ref": "#/definitions/vendorExtension" } }, - "required": ["type"], + "required": [ + "type" + ], "properties": { "format": { "type": "string" @@ -1016,7 +1090,9 @@ }, "type": { "type": "string", - "enum": ["file"] + "enum": [ + "file" + ] }, "readOnly": { "type": "boolean", @@ -1035,7 +1111,13 @@ "properties": { "type": { "type": "string", - "enum": ["string", "number", "integer", "boolean", "array"] + "enum": [ + "string", + "number", + "integer", + "boolean", + "array" + ] }, "format": { "type": "string" @@ -1140,7 +1222,9 @@ "tag": { "type": "object", "additionalProperties": false, - "required": ["name"], + "required": [ + "name" + ], "properties": { "name": { "type": "string" @@ -1186,11 +1270,15 @@ "basicAuthenticationSecurity": { "type": "object", "additionalProperties": false, - "required": ["type"], + "required": [ + "type" + ], "properties": { "type": { "type": "string", - "enum": ["basic"] + "enum": [ + "basic" + ] }, "description": { "type": "string" @@ -1205,18 +1293,27 @@ "apiKeySecurity": { "type": "object", "additionalProperties": false, - "required": ["type", "name", "in"], + "required": [ + "type", + "name", + "in" + ], "properties": { "type": { "type": "string", - "enum": ["apiKey"] + "enum": [ + "apiKey" + ] }, "name": { "type": "string" }, "in": { "type": "string", - "enum": ["header", "query"] + "enum": [ + "header", + "query" + ] }, "description": { "type": "string" @@ -1231,15 +1328,23 @@ "oauth2ImplicitSecurity": { "type": "object", "additionalProperties": false, - "required": ["type", "flow", "authorizationUrl"], + "required": [ + "type", + "flow", + "authorizationUrl" + ], "properties": { "type": { "type": "string", - "enum": ["oauth2"] + "enum": [ + "oauth2" + ] }, "flow": { "type": "string", - "enum": ["implicit"] + "enum": [ + "implicit" + ] }, "scopes": { "$ref": "#/definitions/oauth2Scopes" @@ -1261,15 +1366,23 @@ "oauth2PasswordSecurity": { "type": "object", "additionalProperties": false, - "required": ["type", "flow", "tokenUrl"], + "required": [ + "type", + "flow", + "tokenUrl" + ], "properties": { "type": { "type": "string", - "enum": ["oauth2"] + "enum": [ + "oauth2" + ] }, "flow": { "type": "string", - "enum": ["password"] + "enum": [ + "password" + ] }, "scopes": { "$ref": "#/definitions/oauth2Scopes" @@ -1291,15 +1404,23 @@ "oauth2ApplicationSecurity": { "type": "object", "additionalProperties": false, - "required": ["type", "flow", "tokenUrl"], + "required": [ + "type", + "flow", + "tokenUrl" + ], "properties": { "type": { "type": "string", - "enum": ["oauth2"] + "enum": [ + "oauth2" + ] }, "flow": { "type": "string", - "enum": ["application"] + "enum": [ + "application" + ] }, "scopes": { "$ref": "#/definitions/oauth2Scopes" @@ -1321,15 +1442,24 @@ "oauth2AccessCodeSecurity": { "type": "object", "additionalProperties": false, - "required": ["type", "flow", "authorizationUrl", "tokenUrl"], + "required": [ + "type", + "flow", + "authorizationUrl", + "tokenUrl" + ], "properties": { "type": { "type": "string", - "enum": ["oauth2"] + "enum": [ + "oauth2" + ] }, "flow": { "type": "string", - "enum": ["accessCode"] + "enum": [ + "accessCode" + ] }, "scopes": { "$ref": "#/definitions/oauth2Scopes" @@ -1386,18 +1516,34 @@ "description": "The transfer protocol of the API.", "items": { "type": "string", - "enum": ["http", "https", "ws", "wss"] + "enum": [ + "http", + "https", + "ws", + "wss" + ] }, "uniqueItems": true }, "collectionFormat": { "type": "string", - "enum": ["csv", "ssv", "tsv", "pipes"], + "enum": [ + "csv", + "ssv", + "tsv", + "pipes" + ], "default": "csv" }, "collectionFormatWithMulti": { "type": "string", - "enum": ["csv", "ssv", "tsv", "pipes", "multi"], + "enum": [ + "csv", + "ssv", + "tsv", + "pipes", + "multi" + ], "default": "csv" }, "title": { @@ -1447,7 +1593,9 @@ }, "jsonReference": { "type": "object", - "required": ["$ref"], + "required": [ + "$ref" + ], "additionalProperties": false, "properties": { "$ref": { @@ -1459,4 +1607,4 @@ } } } -} +} \ No newline at end of file diff --git a/vendor/github.com/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md index f0d409be..ca048371 100644 --- a/vendor/github.com/mattn/go-colorable/README.md +++ b/vendor/github.com/mattn/go-colorable/README.md @@ -14,6 +14,7 @@ This package is possible to handle escape sequence for ansi color on windows. ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) + ## So Good! ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) diff --git a/vendor/github.com/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md index fba957fa..38418353 100644 --- a/vendor/github.com/mattn/go-isatty/README.md +++ b/vendor/github.com/mattn/go-isatty/README.md @@ -45,6 +45,6 @@ Yasuhiro Matsumoto (a.k.a mattn) ## Thanks -- k-takata: base idea for IsCygwinTerminal +* k-takata: base idea for IsCygwinTerminal - https://github.com/k-takata/go-iscygpty + https://github.com/k-takata/go-iscygpty diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md index 04eb3881..54dfdcb1 100644 --- a/vendor/github.com/pkg/errors/README.md +++ b/vendor/github.com/pkg/errors/README.md @@ -5,38 +5,31 @@ Package errors provides simple error handling primitives. `go get github.com/pkg/errors` The traditional error handling idiom in Go is roughly akin to - ```go if err != nil { return err } ``` - which applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. ## Adding context to an error The errors.Wrap function returns a new error that adds context to the original error. For example - ```go _, err := ioutil.ReadAll(r) if err != nil { return errors.Wrap(err, "read failed") } ``` - ## Retrieving the cause of an error Using `errors.Wrap` constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by `errors.Cause`. - ```go type causer interface { Cause() error } ``` - `errors.Cause` will recursively retrieve the topmost error which does not implement `causer`, which is assumed to be the original cause. For example: - ```go switch err := errors.Cause(err).(type) { case *MyError: @@ -57,7 +50,7 @@ With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/m ## Contributing -Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. +Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. Before sending a PR, please discuss your change by raising an issue. diff --git a/vendor/github.com/spf13/afero/README.md b/vendor/github.com/spf13/afero/README.md index a9d93b33..3bafbfdf 100644 --- a/vendor/github.com/spf13/afero/README.md +++ b/vendor/github.com/spf13/afero/README.md @@ -23,16 +23,17 @@ package as it provides an additional abstraction that makes it easy to use a memory backed file system during testing. It also adds support for the http filesystem for full interoperability. + ## Afero Features -- A single consistent API for accessing a variety of filesystems -- Interoperation between a variety of file system types -- A set of interfaces to encourage and enforce interoperability between backends -- An atomic cross platform memory backed file system -- Support for compositional (union) file systems by combining multiple file systems acting as one -- Specialized backends which modify existing filesystems (Read Only, Regexp filtered) -- A set of utility functions ported from io, ioutil & hugo to be afero aware -- Wrapper for go 1.16 filesystem abstraction `io/fs.FS` +* A single consistent API for accessing a variety of filesystems +* Interoperation between a variety of file system types +* A set of interfaces to encourage and enforce interoperability between backends +* An atomic cross platform memory backed file system +* Support for compositional (union) file systems by combining multiple file systems acting as one +* Specialized backends which modify existing filesystems (Read Only, Regexp filtered) +* A set of utility functions ported from io, ioutil & hugo to be afero aware +* Wrapper for go 1.16 filesystem abstraction `io/fs.FS` # Using Afero @@ -40,10 +41,10 @@ Afero is easy to use and easier to adopt. A few different ways you could use Afero: -- Use the interfaces alone to define your own file system. -- Wrapper for the OS packages. -- Define different filesystems for different parts of your application. -- Use Afero for mock filesystems while testing +* Use the interfaces alone to define your own file system. +* Wrapper for the OS packages. +* Define different filesystems for different parts of your application. +* Use Afero for mock filesystems while testing ## Step 1: Install Afero @@ -52,7 +53,6 @@ First use go get to install the latest version of the library. $ go get github.com/spf13/afero Next include Afero in your application. - ```go import "github.com/spf13/afero" ``` @@ -60,7 +60,6 @@ import "github.com/spf13/afero" ## Step 2: Declare a backend First define a package variable and set it to a pointer to a filesystem. - ```go var AppFs = afero.NewMemMapFs() @@ -68,7 +67,6 @@ or var AppFs = afero.NewOsFs() ``` - It is important to note that if you repeat the composite literal you will be using a completely new and isolated filesystem. In the case of OsFs it will still use the same underlying filesystem but will reduce @@ -80,23 +78,20 @@ Throughout your application use any function and method like you normally would. So if my application before had: - ```go os.Open("/tmp/foo") ``` - We would replace it with: - ```go AppFs.Open("/tmp/foo") ``` `AppFs` being the variable we defined above. + ## List of all available functions File System Methods Available: - ```go Chmod(name string, mode os.FileMode) : error Chown(name string, uid, gid int) : error @@ -112,9 +107,7 @@ RemoveAll(path string) : error Rename(oldname, newname string) : error Stat(name string) : os.FileInfo, error ``` - File Interfaces and Methods Available: - ```go io.Closer io.Reader @@ -131,7 +124,6 @@ Sync() : error Truncate(size int64) : error WriteString(s string) : ret int, err error ``` - In some applications it may make sense to define a new package that simply exports the file system variable for easy access from anywhere. @@ -160,7 +152,6 @@ Walk(root string, walkFn filepath.WalkFunc) error WriteFile(filename string, data []byte, perm os.FileMode) error WriteReader(path string, r io.Reader) (err error) ``` - For a complete list see [Afero's GoDoc](https://godoc.org/github.com/spf13/afero) They are available under two different approaches to use. You can either call @@ -193,11 +184,11 @@ and the file access would be fast while also saving you from all the annoying issues with deleting temporary files, Windows file locking, etc. The MemMapFs backend is perfect for testing. -- Much faster than performing I/O operations on disk -- Avoid security issues and permissions -- Far more control. 'rm -rf /' with confidence -- Test setup is far more easier to do -- No test cleanup needed +* Much faster than performing I/O operations on disk +* Avoid security issues and permissions +* Far more control. 'rm -rf /' with confidence +* Test setup is far more easier to do +* No test cleanup needed One way to accomplish this is to define a variable as mentioned above. In your application this will be set to afero.NewOsFs() during testing you @@ -209,7 +200,6 @@ appropriate in my application code. This approach ensures that Tests are order independent, with no test relying on the state left by an earlier test. Then in my tests I would initialize a new MemMapFs for each test: - ```go func TestExist(t *testing.T) { appFS := afero.NewMemMapFs() @@ -276,10 +266,10 @@ Afero has experimental support for Google Cloud Storage (GCS). You can either se `NewGcsFS` to configure access to your GCS bucket. Some known limitations of the existing implementation: +* No Chmod support - The GCS ACL could probably be mapped to *nix style permissions but that would add another level of complexity and is ignored in this version. +* No Chtimes support - Could be simulated with attributes (gcs a/m-times are set implicitly) but that's is left for another version. +* Not thread safe - Also assumes all file operations are done through the same instance of the GcsFs. File operations between different GcsFs instances are not guaranteed to be consistent. -- No Chmod support - The GCS ACL could probably be mapped to \*nix style permissions but that would add another level of complexity and is ignored in this version. -- No Chtimes support - Could be simulated with attributes (gcs a/m-times are set implicitly) but that's is left for another version. -- Not thread safe - Also assumes all file operations are done through the same instance of the GcsFs. File operations between different GcsFs instances are not guaranteed to be consistent. ## Filtering Backends @@ -396,13 +386,14 @@ overlay will be removed/renamed. In this example all write operations will only occur in memory (MemMapFs) leaving the base filesystem (OsFs) untouched. + ## Desired/possible backends The following is a short list of possible backends we hope someone will implement: -- SSH -- S3 +* SSH +* S3 # About the project @@ -440,10 +431,10 @@ See the [Releases Page](https://github.com/spf13/afero/releases). Names in no particular order: -- [spf13](https://github.com/spf13) -- [jaqx0r](https://github.com/jaqx0r) -- [mbertschler](https://github.com/mbertschler) -- [xor-gate](https://github.com/xor-gate) +* [spf13](https://github.com/spf13) +* [jaqx0r](https://github.com/jaqx0r) +* [mbertschler](https://github.com/mbertschler) +* [xor-gate](https://github.com/xor-gate) ## License diff --git a/vendor/github.com/spf13/cobra/CONDUCT.md b/vendor/github.com/spf13/cobra/CONDUCT.md index 78c1c1ee..9d16f88f 100644 --- a/vendor/github.com/spf13/cobra/CONDUCT.md +++ b/vendor/github.com/spf13/cobra/CONDUCT.md @@ -1,27 +1,21 @@ ## Cobra User Contract ### Versioning - Cobra will follow a steady release cadence. Non breaking changes will be released as minor versions quarterly. Patch bug releases are at the discretion of the maintainers. Users can expect security patch fixes to be released within relatively short order of a CVE becoming known. For more information on security patch fixes see the CVE section below. Releases will follow [Semantic Versioning](https://semver.org/). Users tracking the Master branch should expect unpredictable breaking changes as the project continues to move forward. For stability, it is highly recommended to use a release. ### Backward Compatibility - We will maintain two major releases in a moving window. The N-1 release will only receive bug fixes and security updates and will be dropped once N+1 is released. ### Deprecation - Deprecation of Go versions or dependent packages will only occur in major releases. To reduce the change of this taking users by surprise, any large deprecation will be preceded by an announcement in the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) and an Issue on Github. ### CVE - Maintainers will make every effort to release security patches in the case of a medium to high severity CVE directly impacting the library. The speed in which these patches reach a release is up to the discretion of the maintainers. A low severity CVE may be a lower priority than a high severity one. ### Communication - Cobra maintainers will use GitHub issues and the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) as the primary means of communication with the community. This is to foster open communication with all users and contributors. ### Breaking Changes - Breaking changes are generally allowed in the master branch, as this is the branch used to develop the next release of Cobra. There may be times, however, when master is closed for breaking changes. This is likely to happen as we near the release of a new version. @@ -29,7 +23,6 @@ There may be times, however, when master is closed for breaking changes. This is Breaking changes are not allowed in release branches, as these represent minor versions that have already been released. These version have consumers who expect the APIs, behaviors, etc, to remain stable during the lifetime of the patch stream for the minor release. Examples of breaking changes include: - - Removing or renaming exported constant, variable, type, or function. - Updating the version of critical libraries such as `spf13/pflag`, `spf13/viper` etc... - Some version updates may be acceptable for picking up bug fixes, but maintainers must exercise caution when reviewing. @@ -37,10 +30,8 @@ Examples of breaking changes include: There may, at times, need to be exceptions where breaking changes are allowed in release branches. These are at the discretion of the project's maintainers, and must be carefully considered before merging. ### CI Testing - Maintainers will ensure the Cobra test suite utilizes the current supported versions of Golang. ### Disclaimer - Changes to this document and the contents therein are at the discretion of the maintainers. None of the contents of this document are legally binding in any way to the maintainers or the users. diff --git a/vendor/github.com/spf13/cobra/CONTRIBUTING.md b/vendor/github.com/spf13/cobra/CONTRIBUTING.md index e80ab9ce..6f356e6a 100644 --- a/vendor/github.com/spf13/cobra/CONTRIBUTING.md +++ b/vendor/github.com/spf13/cobra/CONTRIBUTING.md @@ -47,5 +47,4 @@ If you have questions regarding Cobra, feel free to ask it in the community 1. Create new pull request - [cobra-slack]: https://gophers.slack.com/archives/CD3LP1199 diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 3501f5cc..6444f4b7 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -17,20 +17,19 @@ Cobra is a library providing a simple interface to create powerful modern CLI interfaces similar to git & go tools. Cobra provides: - -- Easy subcommand-based CLIs: `app server`, `app fetch`, etc. -- Fully POSIX-compliant flags (including short & long versions) -- Nested subcommands -- Global, local and cascading flags -- Intelligent suggestions (`app srver`... did you mean `app server`?) -- Automatic help generation for commands and flags -- Grouping help for subcommands -- Automatic help flag recognition of `-h`, `--help`, etc. -- Automatically generated shell autocomplete for your application (bash, zsh, fish, powershell) -- Automatically generated man pages for your application -- Command aliases so you can change things without breaking them -- The flexibility to define your own help, usage, etc. -- Optional seamless integration with [viper](https://github.com/spf13/viper) for 12-factor apps +* Easy subcommand-based CLIs: `app server`, `app fetch`, etc. +* Fully POSIX-compliant flags (including short & long versions) +* Nested subcommands +* Global, local and cascading flags +* Intelligent suggestions (`app srver`... did you mean `app server`?) +* Automatic help generation for commands and flags +* Grouping help for subcommands +* Automatic help flag recognition of `-h`, `--help`, etc. +* Automatically generated shell autocomplete for your application (bash, zsh, fish, powershell) +* Automatically generated man pages for your application +* Command aliases so you can change things without breaking them +* The flexibility to define your own help, usage, etc. +* Optional seamless integration with [viper](https://github.com/spf13/viper) for 12-factor apps # Concepts @@ -43,7 +42,7 @@ intuitively know how to interact with them. The pattern to follow is `APPNAME VERB NOUN --ADJECTIVE` -or + or `APPNAME COMMAND ARG --FLAG`. A few good real world examples may better illustrate this point. @@ -80,7 +79,6 @@ library](https://github.com/spf13/pflag), a fork of the flag standard library which maintains the same interface while adding POSIX compliance. # Installing - Using Cobra is easy. First, use `go get` to install the latest version of the library. @@ -95,7 +93,6 @@ import "github.com/spf13/cobra" ``` # Usage - `cobra-cli` is a command line program to generate cobra applications and command files. It will bootstrap your application scaffolding to rapidly develop a Cobra-based application. It is the easiest way to incorporate Cobra into your application. diff --git a/vendor/golang.org/x/oauth2/pkce.go b/vendor/golang.org/x/oauth2/pkce.go index 50593b6d..6a95da97 100644 --- a/vendor/golang.org/x/oauth2/pkce.go +++ b/vendor/golang.org/x/oauth2/pkce.go @@ -21,7 +21,7 @@ const ( // // A fresh verifier should be generated for each authorization. // S256ChallengeOption(verifier) should then be passed to Config.AuthCodeURL -// (or Config.DeviceAccess) and VerifierOption(verifier) to Config.Exchange +// (or Config.DeviceAuth) and VerifierOption(verifier) to Config.Exchange // (or Config.DeviceAccessToken). func GenerateVerifier() string { // "RECOMMENDED that the output of a suitable random number generator be @@ -51,7 +51,7 @@ func S256ChallengeFromVerifier(verifier string) string { } // S256ChallengeOption derives a PKCE code challenge derived from verifier with -// method S256. It should be passed to Config.AuthCodeURL or Config.DeviceAccess +// method S256. It should be passed to Config.AuthCodeURL or Config.DeviceAuth // only. func S256ChallengeOption(verifier string) AuthCodeOption { return challengeOption{ diff --git a/vendor/gopkg.in/yaml.v2/README.md b/vendor/gopkg.in/yaml.v2/README.md index da1477c6..b50c6e87 100644 --- a/vendor/gopkg.in/yaml.v2/README.md +++ b/vendor/gopkg.in/yaml.v2/README.md @@ -1,6 +1,7 @@ # YAML support for the Go language -## Introduction +Introduction +------------ The yaml package enables Go programs to comfortably encode and decode YAML values. It was developed within [Canonical](https://www.canonical.com) as @@ -8,36 +9,44 @@ part of the [juju](https://juju.ubuntu.com) project, and is based on a pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) C library to parse and generate YAML data quickly and reliably. -## Compatibility +Compatibility +------------- The yaml package supports most of YAML 1.1 and 1.2, including support for anchors, tags, map merging, etc. Multi-document unmarshalling is not yet implemented, and base-60 floats from YAML 1.1 are purposefully not supported since they're a poor design and are gone in YAML 1.2. -## Installation and usage +Installation and usage +---------------------- -The import path for the package is _gopkg.in/yaml.v2_. +The import path for the package is *gopkg.in/yaml.v2*. To install it, run: go get gopkg.in/yaml.v2 -## API documentation +API documentation +----------------- If opened in a browser, the import path itself leads to the API documentation: -- [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) + * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) -## API stability +API stability +------------- The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). -## License + +License +------- The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. -## Example + +Example +------- ```Go package main @@ -68,27 +77,27 @@ type T struct { func main() { t := T{} - + err := yaml.Unmarshal([]byte(data), &t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t:\n%v\n\n", t) - + d, err := yaml.Marshal(&t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t dump:\n%s\n\n", string(d)) - + m := make(map[interface{}]interface{}) - + err = yaml.Unmarshal([]byte(data), &m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m:\n%v\n\n", m) - + d, err = yaml.Marshal(&m) if err != nil { log.Fatalf("error: %v", err) @@ -121,3 +130,4 @@ b: - 3 - 4 ``` + diff --git a/vendor/gopkg.in/yaml.v3/README.md b/vendor/gopkg.in/yaml.v3/README.md index 2bb5edaa..08eb1bab 100644 --- a/vendor/gopkg.in/yaml.v3/README.md +++ b/vendor/gopkg.in/yaml.v3/README.md @@ -1,6 +1,7 @@ # YAML support for the Go language -## Introduction +Introduction +------------ The yaml package enables Go programs to comfortably encode and decode YAML values. It was developed within [Canonical](https://www.canonical.com) as @@ -8,21 +9,22 @@ part of the [juju](https://juju.ubuntu.com) project, and is based on a pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) C library to parse and generate YAML data quickly and reliably. -## Compatibility +Compatibility +------------- The yaml package supports most of YAML 1.2, but preserves some behavior from 1.1 for backwards compatibility. Specifically, as of v3 of the yaml package: -- YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being - decoded into a typed bool value. Otherwise they behave as a string. Booleans - in YAML 1.2 are _true/false_ only. -- Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ - as specified in YAML 1.2, because most parsers still use the old format. - Octals in the _0o777_ format are supported though, so new files work. -- Does not support base-60 floats. These are gone from YAML 1.2, and were - actually never supported by this package as it's clearly a poor choice. + - YAML 1.1 bools (_yes/no, on/off_) are supported as long as they are being + decoded into a typed bool value. Otherwise they behave as a string. Booleans + in YAML 1.2 are _true/false_ only. + - Octals encode and decode as _0777_ per YAML 1.1, rather than _0o777_ + as specified in YAML 1.2, because most parsers still use the old format. + Octals in the _0o777_ format are supported though, so new files work. + - Does not support base-60 floats. These are gone from YAML 1.2, and were + actually never supported by this package as it's clearly a poor choice. and offers backwards compatibility with YAML 1.1 in some cases. @@ -31,30 +33,37 @@ anchors, tags, map merging, etc. Multi-document unmarshalling is not yet implemented, and base-60 floats from YAML 1.1 are purposefully not supported since they're a poor design and are gone in YAML 1.2. -## Installation and usage +Installation and usage +---------------------- -The import path for the package is _gopkg.in/yaml.v3_. +The import path for the package is *gopkg.in/yaml.v3*. To install it, run: go get gopkg.in/yaml.v3 -## API documentation +API documentation +----------------- If opened in a browser, the import path itself leads to the API documentation: -- [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) + - [https://gopkg.in/yaml.v3](https://gopkg.in/yaml.v3) -## API stability +API stability +------------- The package API for yaml v3 will remain stable as described in [gopkg.in](https://gopkg.in). -## License + +License +------- The yaml package is licensed under the MIT and Apache License 2.0 licenses. Please see the LICENSE file for details. -## Example + +Example +------- ```Go package main @@ -85,27 +94,27 @@ type T struct { func main() { t := T{} - + err := yaml.Unmarshal([]byte(data), &t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t:\n%v\n\n", t) - + d, err := yaml.Marshal(&t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t dump:\n%s\n\n", string(d)) - + m := make(map[interface{}]interface{}) - + err = yaml.Unmarshal([]byte(data), &m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m:\n%v\n\n", m) - + d, err = yaml.Marshal(&m) if err != nil { log.Fatalf("error: %v", err) @@ -138,3 +147,4 @@ b: - 3 - 4 ``` + diff --git a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md index 408e2d06..0349adf6 100644 --- a/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md +++ b/vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md @@ -9,45 +9,45 @@ Do not depend on this in publicly available modules. ## Goals and objectives -- **Mostly backwards compatible:** If possible, v2 should aim to be _mostly_ - compatible with v1 in terms of both API and default behavior to ease migration. - For example, the `Marshal` and `Unmarshal` functions are the most widely used - declarations in the v1 package. It seems sensible for equivalent functionality - in v2 to be named the same and have the same signature. - Behaviorally, we should aim for 95% to 99% backwards compatibility. - We do not aim for 100% compatibility since we want the freedom to break - certain behaviors that are now considered to have been a mistake. - We may provide options that can bring the v2 implementation to 100% compatibility, - but it will not be the default. - -- **More flexible:** There is a - [long list of feature requests](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle). - We should aim to provide the most flexible features that addresses most usages. - We do not want to over fit the v2 API to handle every possible use case. - Ideally, the features provided should be orthogonal in nature such that - any combination of features results in as few surprising edge cases as possible. - -- **More performant:** JSON serialization is widely used and any bit of extra - performance gains will be greatly appreciated. Some rarely used behaviors of v1 - may be dropped in favor of better performance. For example, - despite `Encoder` and `Decoder` operating on an `io.Writer` and `io.Reader`, - they do not operate in a truly streaming manner, - leading to a loss in performance. The v2 implementation should aim to be truly - streaming by default (see [#33714](https://golang.org/issue/33714)). - -- **Easy to use (hard to misuse):** The v2 API should aim to make - the common case easy and the less common case at least possible. - The API should avoid behavior that goes contrary to user expectation, - which may result in subtle bugs (see [#36225](https://golang.org/issue/36225)). - -- **v1 and v2 maintainability:** Since the v1 implementation must stay forever, - it would be beneficial if v1 could be implemented under the hood with v2, - allowing for less maintenance burden in the future. This probably implies that - behavioral changes in v2 relative to v1 need to be exposed as options. - -- **Avoid unsafe:** Standard library packages generally avoid the use of - package `unsafe` even if it could provide a performance boost. - We aim to preserve this property. +* **Mostly backwards compatible:** If possible, v2 should aim to be _mostly_ +compatible with v1 in terms of both API and default behavior to ease migration. +For example, the `Marshal` and `Unmarshal` functions are the most widely used +declarations in the v1 package. It seems sensible for equivalent functionality +in v2 to be named the same and have the same signature. +Behaviorally, we should aim for 95% to 99% backwards compatibility. +We do not aim for 100% compatibility since we want the freedom to break +certain behaviors that are now considered to have been a mistake. +We may provide options that can bring the v2 implementation to 100% compatibility, +but it will not be the default. + +* **More flexible:** There is a +[long list of feature requests](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+encoding%2Fjson+in%3Atitle). +We should aim to provide the most flexible features that addresses most usages. +We do not want to over fit the v2 API to handle every possible use case. +Ideally, the features provided should be orthogonal in nature such that +any combination of features results in as few surprising edge cases as possible. + +* **More performant:** JSON serialization is widely used and any bit of extra +performance gains will be greatly appreciated. Some rarely used behaviors of v1 +may be dropped in favor of better performance. For example, +despite `Encoder` and `Decoder` operating on an `io.Writer` and `io.Reader`, +they do not operate in a truly streaming manner, +leading to a loss in performance. The v2 implementation should aim to be truly +streaming by default (see [#33714](https://golang.org/issue/33714)). + +* **Easy to use (hard to misuse):** The v2 API should aim to make +the common case easy and the less common case at least possible. +The API should avoid behavior that goes contrary to user expectation, +which may result in subtle bugs (see [#36225](https://golang.org/issue/36225)). + +* **v1 and v2 maintainability:** Since the v1 implementation must stay forever, +it would be beneficial if v1 could be implemented under the hood with v2, +allowing for less maintenance burden in the future. This probably implies that +behavioral changes in v2 relative to v1 need to be exposed as options. + +* **Avoid unsafe:** Standard library packages generally avoid the use of +package `unsafe` even if it could provide a performance boost. +We aim to preserve this property. ## Expectations @@ -59,16 +59,15 @@ At the present moment, this is still in the design and experimentation phase and is not ready for a formal proposal. There are several possible outcomes from this experiment: - 1. We determine that a v2 `encoding/json` would not provide sufficient benefit - over the existing v1 `encoding/json` package. Thus, we abandon this effort. +over the existing v1 `encoding/json` package. Thus, we abandon this effort. 2. We propose a v2 `encoding/json` design, but it is rejected in favor of some - other design that is considered superior. +other design that is considered superior. 3. We propose a v2 `encoding/json` design, but rather than adding an entirely - new v2 `encoding/json` package, we decide to merge its functionality into - the existing v1 `encoding/json` package. +new v2 `encoding/json` package, we decide to merge its functionality into +the existing v1 `encoding/json` package. 4. We propose a v2 `encoding/json` design and it is accepted, resulting in - its addition to the standard library. +its addition to the standard library. 5. Some other unforeseen outcome (among the infinite number of possibilities). ## Development @@ -127,30 +126,30 @@ behavior similar to what v1 provided. This table shows an overview of the changes: -| v1 | v2 | Details | -| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -| JSON object members are unmarshaled into a Go struct using a **case-insensitive name match**. | JSON object members are unmarshaled into a Go struct using a **case-sensitive name match**. | [CaseSensitivity](/diff_test.go#:~:text=TestCaseSensitivity) | -| When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value is an empty Go value**, which is defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string. | When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value would encode as an empty JSON value**, which is defined as a JSON null, or an empty JSON string, object, or array. | [OmitEmptyOption](/diff_test.go#:~:text=TestOmitEmptyOption) | -| The `string` option **does affect** Go bools. | The `string` option **does not affect** Go bools. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| The `string` option **does not recursively affect** sub-values of the Go field value. | The `string` option **does recursively affect** sub-values of the Go field value. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| The `string` option **sometimes accepts** a JSON null escaped within a JSON string. | The `string` option **never accepts** a JSON null escaped within a JSON string. | [StringOption](/diff_test.go#:~:text=TestStringOption) | -| A nil Go slice is marshaled as a **JSON null**. | A nil Go slice is marshaled as an **empty JSON array**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | -| A nil Go map is marshaled as a **JSON null**. | A nil Go map is marshaled as an **empty JSON object**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | -| A Go array may be unmarshaled from a **JSON array of any length**. | A Go array must be unmarshaled from a **JSON array of the same length**. | [Arrays](/diff_test.go#:~:text=Arrays) | -| A Go byte array is represented as a **JSON array of JSON numbers**. | A Go byte array is represented as a **Base64-encoded JSON string**. | [ByteArrays](/diff_test.go#:~:text=TestByteArrays) | -| `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **inconsistently called**. | `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **consistently called**. | [PointerReceiver](/diff_test.go#:~:text=TestPointerReceiver) | -| A Go map is marshaled in a **deterministic order**. | A Go map is marshaled in a **non-deterministic order**. | [MapDeterminism](/diff_test.go#:~:text=TestMapDeterminism) | -| JSON strings are encoded **with HTML-specific characters being escaped**. | JSON strings are encoded **without any characters being escaped** (unless necessary). | [EscapeHTML](/diff_test.go#:~:text=TestEscapeHTML) | -| When marshaling, invalid UTF-8 within a Go string **are silently replaced**. | When marshaling, invalid UTF-8 within a Go string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | -| When unmarshaling, invalid UTF-8 within a JSON string **are silently replaced**. | When unmarshaling, invalid UTF-8 within a JSON string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | -| When marshaling, **an error does not occur** if the output JSON value contains objects with duplicate names. | When marshaling, **an error does occur** if the output JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | -| When unmarshaling, **an error does not occur** if the input JSON value contains objects with duplicate names. | When unmarshaling, **an error does occur** if the input JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | -| Unmarshaling a JSON null into a non-empty Go value **inconsistently clears the value or does nothing**. | Unmarshaling a JSON null into a non-empty Go value **always clears the value**. | [MergeNull](/diff_test.go#:~:text=TestMergeNull) | -| Unmarshaling a JSON value into a non-empty Go value **follows inconsistent and bizarre behavior**. | Unmarshaling a JSON value into a non-empty Go value **always merges if the input is an object, and otherwise replaces**. | [MergeComposite](/diff_test.go#:~:text=TestMergeComposite) | -| A `time.Duration` is represented as a **JSON number containing the decimal number of nanoseconds**. | A `time.Duration` is represented as a **JSON string containing the formatted duration (e.g., "1h2m3.456s")**. | [TimeDurations](/diff_test.go#:~:text=TestTimeDurations) | -| Unmarshaling a JSON number into a Go float beyond its representation **results in an error**. | Unmarshaling a JSON number into a Go float beyond its representation **uses the closest representable value (e.g., ±`math.MaxFloat`)**. | [MaxFloats](/diff_test.go#:~:text=TestMaxFloats) | -| A Go struct with only unexported fields **can be serialized**. | A Go struct with only unexported fields **cannot be serialized**. | [EmptyStructs](/diff_test.go#:~:text=TestEmptyStructs) | -| A Go struct that embeds an unexported struct type **can sometimes be serialized**. | A Go struct that embeds an unexported struct type **cannot be serialized**. | [EmbedUnexported](/diff_test.go#:~:text=TestEmbedUnexported) | +| v1 | v2 | Details | +| -- | -- | ------- | +| JSON object members are unmarshaled into a Go struct using a **case-insensitive name match**. | JSON object members are unmarshaled into a Go struct using a **case-sensitive name match**. | [CaseSensitivity](/diff_test.go#:~:text=TestCaseSensitivity) | +| When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value is an empty Go value**, which is defined as false, 0, a nil pointer, a nil interface value, and any empty array, slice, map, or string. | When marshaling a Go struct, a struct field marked as `omitempty` is omitted if **the field value would encode as an empty JSON value**, which is defined as a JSON null, or an empty JSON string, object, or array. | [OmitEmptyOption](/diff_test.go#:~:text=TestOmitEmptyOption) | +| The `string` option **does affect** Go bools. | The `string` option **does not affect** Go bools. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| The `string` option **does not recursively affect** sub-values of the Go field value. | The `string` option **does recursively affect** sub-values of the Go field value. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| The `string` option **sometimes accepts** a JSON null escaped within a JSON string. | The `string` option **never accepts** a JSON null escaped within a JSON string. | [StringOption](/diff_test.go#:~:text=TestStringOption) | +| A nil Go slice is marshaled as a **JSON null**. | A nil Go slice is marshaled as an **empty JSON array**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | +| A nil Go map is marshaled as a **JSON null**. | A nil Go map is marshaled as an **empty JSON object**. | [NilSlicesAndMaps](/diff_test.go#:~:text=TestNilSlicesAndMaps) | +| A Go array may be unmarshaled from a **JSON array of any length**. | A Go array must be unmarshaled from a **JSON array of the same length**. | [Arrays](/diff_test.go#:~:text=Arrays) | +| A Go byte array is represented as a **JSON array of JSON numbers**. | A Go byte array is represented as a **Base64-encoded JSON string**. | [ByteArrays](/diff_test.go#:~:text=TestByteArrays) | +| `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **inconsistently called**. | `MarshalJSON` and `UnmarshalJSON` methods declared on a pointer receiver are **consistently called**. | [PointerReceiver](/diff_test.go#:~:text=TestPointerReceiver) | +| A Go map is marshaled in a **deterministic order**. | A Go map is marshaled in a **non-deterministic order**. | [MapDeterminism](/diff_test.go#:~:text=TestMapDeterminism) | +| JSON strings are encoded **with HTML-specific characters being escaped**. | JSON strings are encoded **without any characters being escaped** (unless necessary). | [EscapeHTML](/diff_test.go#:~:text=TestEscapeHTML) | +| When marshaling, invalid UTF-8 within a Go string **are silently replaced**. | When marshaling, invalid UTF-8 within a Go string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | +| When unmarshaling, invalid UTF-8 within a JSON string **are silently replaced**. | When unmarshaling, invalid UTF-8 within a JSON string **results in an error**. | [InvalidUTF8](/diff_test.go#:~:text=TestInvalidUTF8) | +| When marshaling, **an error does not occur** if the output JSON value contains objects with duplicate names. | When marshaling, **an error does occur** if the output JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | +| When unmarshaling, **an error does not occur** if the input JSON value contains objects with duplicate names. | When unmarshaling, **an error does occur** if the input JSON value contains objects with duplicate names. | [DuplicateNames](/diff_test.go#:~:text=TestDuplicateNames) | +| Unmarshaling a JSON null into a non-empty Go value **inconsistently clears the value or does nothing**. | Unmarshaling a JSON null into a non-empty Go value **always clears the value**. | [MergeNull](/diff_test.go#:~:text=TestMergeNull) | +| Unmarshaling a JSON value into a non-empty Go value **follows inconsistent and bizarre behavior**. | Unmarshaling a JSON value into a non-empty Go value **always merges if the input is an object, and otherwise replaces**. | [MergeComposite](/diff_test.go#:~:text=TestMergeComposite) | +| A `time.Duration` is represented as a **JSON number containing the decimal number of nanoseconds**. | A `time.Duration` is represented as a **JSON string containing the formatted duration (e.g., "1h2m3.456s")**. | [TimeDurations](/diff_test.go#:~:text=TestTimeDurations) | +| Unmarshaling a JSON number into a Go float beyond its representation **results in an error**. | Unmarshaling a JSON number into a Go float beyond its representation **uses the closest representable value (e.g., ±`math.MaxFloat`)**. | [MaxFloats](/diff_test.go#:~:text=TestMaxFloats) | +| A Go struct with only unexported fields **can be serialized**. | A Go struct with only unexported fields **cannot be serialized**. | [EmptyStructs](/diff_test.go#:~:text=TestEmptyStructs) | +| A Go struct that embeds an unexported struct type **can sometimes be serialized**. | A Go struct that embeds an unexported struct type **cannot be serialized**. | [EmbedUnexported](/diff_test.go#:~:text=TestEmbedUnexported) | See [diff_test.go](/diff_test.go) for details about every change. @@ -161,27 +160,27 @@ One of the goals of the v2 module is to be more performant than v1. Each of the charts below show the performance across several different JSON implementations: -- `JSONv1` is `encoding/json` at `v1.18.2` -- `JSONv2` is `github.com/go-json-experiment/json` at `v0.0.0-20220524042235-dd8be80fc4a7` -- `JSONIterator` is `github.com/json-iterator/go` at `v1.1.12` -- `SegmentJSON` is `github.com/segmentio/encoding/json` at `v0.3.5` -- `GoJSON` is `github.com/goccy/go-json` at `v0.9.7` -- `SonicJSON` is `github.com/bytedance/sonic` at `v1.3.0` +* `JSONv1` is `encoding/json` at `v1.18.2` +* `JSONv2` is `github.com/go-json-experiment/json` at `v0.0.0-20220524042235-dd8be80fc4a7` +* `JSONIterator` is `github.com/json-iterator/go` at `v1.1.12` +* `SegmentJSON` is `github.com/segmentio/encoding/json` at `v0.3.5` +* `GoJSON` is `github.com/goccy/go-json` at `v0.9.7` +* `SonicJSON` is `github.com/bytedance/sonic` at `v1.3.0` Benchmarks were run across various datasets: -- `CanadaGeometry` is a GeoJSON (RFC 7946) representation of Canada. +* `CanadaGeometry` is a GeoJSON (RFC 7946) representation of Canada. It contains many JSON arrays of arrays of two-element arrays of numbers. -- `CITMCatalog` contains many JSON objects using numeric names. -- `SyntheaFHIR` is sample JSON data from the healthcare industry. +* `CITMCatalog` contains many JSON objects using numeric names. +* `SyntheaFHIR` is sample JSON data from the healthcare industry. It contains many nested JSON objects with mostly string values, where the set of unique string values is relatively small. -- `TwitterStatus` is the JSON response from the Twitter API. +* `TwitterStatus` is the JSON response from the Twitter API. It contains a mix of all different JSON kinds, where string values are a mix of both single-byte ASCII and multi-byte Unicode. -- `GolangSource` is a simple tree representing the Go source code. +* `GolangSource` is a simple tree representing the Go source code. It contains many nested JSON objects, each with the same schema. -- `StringUnicode` contains many strings with multi-byte Unicode runes. +* `StringUnicode` contains many strings with multi-byte Unicode runes. All of the implementations other than `JSONv1` and `JSONv2` make extensive use of `unsafe`. As such, we expect those to generally be faster, @@ -224,31 +223,31 @@ https://github.com/go-json-experiment/jsonbench. ![Benchmark Marshal Concrete](benchmark-marshal-concrete.png) -- This compares marshal performance when serializing +* This compares marshal performance when serializing [from concrete types](/testdata_test.go). -- The `JSONv1` implementation is close to optimal (without the use of `unsafe`). -- Relative to `JSONv1`, `JSONv2` is generally as fast or slightly faster. -- Relative to `JSONIterator`, `JSONv2` is up to 1.3x faster. -- Relative to `SegmentJSON`, `JSONv2` is up to 1.8x slower. -- Relative to `GoJSON`, `JSONv2` is up to 2.0x slower. -- Relative to `SonicJSON`, `JSONv2` is about 1.8x to 3.2x slower +* The `JSONv1` implementation is close to optimal (without the use of `unsafe`). +* Relative to `JSONv1`, `JSONv2` is generally as fast or slightly faster. +* Relative to `JSONIterator`, `JSONv2` is up to 1.3x faster. +* Relative to `SegmentJSON`, `JSONv2` is up to 1.8x slower. +* Relative to `GoJSON`, `JSONv2` is up to 2.0x slower. +* Relative to `SonicJSON`, `JSONv2` is about 1.8x to 3.2x slower (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8). -- For `JSONv1` and `JSONv2`, marshaling from concrete types is +* For `JSONv1` and `JSONv2`, marshaling from concrete types is mostly limited by the performance of Go reflection. #### Interface types ![Benchmark Marshal Interface](benchmark-marshal-interface.png) -- This compares marshal performance when serializing from +* This compares marshal performance when serializing from `any`, `map[string]any`, and `[]any` types. -- Relative to `JSONv1`, `JSONv2` is about 1.5x to 4.2x faster. -- Relative to `JSONIterator`, `JSONv2` is about 1.1x to 2.4x faster. -- Relative to `SegmentJSON`, `JSONv2` is about 1.2x to 1.8x faster. -- Relative to `GoJSON`, `JSONv2` is about 1.1x to 2.5x faster. -- Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower +* Relative to `JSONv1`, `JSONv2` is about 1.5x to 4.2x faster. +* Relative to `JSONIterator`, `JSONv2` is about 1.1x to 2.4x faster. +* Relative to `SegmentJSON`, `JSONv2` is about 1.2x to 1.8x faster. +* Relative to `GoJSON`, `JSONv2` is about 1.1x to 2.5x faster. +* Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8). -- `JSONv2` is faster than the alternatives. +* `JSONv2` is faster than the alternatives. One advantange is because it does not sort the keys for a `map[string]any`, while alternatives (except `SonicJSON` and `JSONIterator`) do sort the keys. @@ -256,17 +255,17 @@ https://github.com/go-json-experiment/jsonbench. ![Benchmark Marshal Rawvalue](benchmark-marshal-rawvalue.png) -- This compares performance when marshaling from a `json.RawValue`. +* This compares performance when marshaling from a `json.RawValue`. This mostly exercises the underlying encoder and hides the cost of Go reflection. -- Relative to `JSONv1`, `JSONv2` is about 3.5x to 7.8x faster. -- `JSONIterator` is blazingly fast because +* Relative to `JSONv1`, `JSONv2` is about 3.5x to 7.8x faster. +* `JSONIterator` is blazingly fast because [it does not validate whether the raw value is valid](https://go.dev/play/p/bun9IXQCKRe) and simply copies it to the output. -- Relative to `SegmentJSON`, `JSONv2` is about 1.5x to 2.7x faster. -- Relative to `GoJSON`, `JSONv2` is up to 2.2x faster. -- Relative to `SonicJSON`, `JSONv2` is up to 1.5x faster. -- Aside from `JSONIterator`, `JSONv2` is generally the fastest. +* Relative to `SegmentJSON`, `JSONv2` is about 1.5x to 2.7x faster. +* Relative to `GoJSON`, `JSONv2` is up to 2.2x faster. +* Relative to `SonicJSON`, `JSONv2` is up to 1.5x faster. +* Aside from `JSONIterator`, `JSONv2` is generally the fastest. ### Unmarshal Performance @@ -274,49 +273,49 @@ https://github.com/go-json-experiment/jsonbench. ![Benchmark Unmarshal Concrete](benchmark-unmarshal-concrete.png) -- This compares unmarshal performance when deserializing +* This compares unmarshal performance when deserializing [into concrete types](/testdata_test.go). -- Relative to `JSONv1`, `JSONv2` is about 1.8x to 5.7x faster. -- Relative to `JSONIterator`, `JSONv2` is about 1.1x to 1.6x slower. -- Relative to `SegmentJSON`, `JSONv2` is up to 2.5x slower. -- Relative to `GoJSON`, `JSONv2` is about 1.4x to 2.1x slower. -- Relative to `SonicJSON`, `JSONv2` is up to 4.0x slower +* Relative to `JSONv1`, `JSONv2` is about 1.8x to 5.7x faster. +* Relative to `JSONIterator`, `JSONv2` is about 1.1x to 1.6x slower. +* Relative to `SegmentJSON`, `JSONv2` is up to 2.5x slower. +* Relative to `GoJSON`, `JSONv2` is about 1.4x to 2.1x slower. +* Relative to `SonicJSON`, `JSONv2` is up to 4.0x slower (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8). -- For `JSONv1` and `JSONv2`, unmarshaling into concrete types is +* For `JSONv1` and `JSONv2`, unmarshaling into concrete types is mostly limited by the performance of Go reflection. #### Interface types ![Benchmark Unmarshal Interface](benchmark-unmarshal-interface.png) -- This compares unmarshal performance when deserializing into +* This compares unmarshal performance when deserializing into `any`, `map[string]any`, and `[]any` types. -- Relative to `JSONv1`, `JSONv2` is about 1.tx to 4.3x faster. -- Relative to `JSONIterator`, `JSONv2` is up to 1.5x faster. -- Relative to `SegmentJSON`, `JSONv2` is about 1.5 to 3.7x faster. -- Relative to `GoJSON`, `JSONv2` is up to 1.3x faster. -- Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower +* Relative to `JSONv1`, `JSONv2` is about 1.tx to 4.3x faster. +* Relative to `JSONIterator`, `JSONv2` is up to 1.5x faster. +* Relative to `SegmentJSON`, `JSONv2` is about 1.5 to 3.7x faster. +* Relative to `GoJSON`, `JSONv2` is up to 1.3x faster. +* Relative to `SonicJSON`, `JSONv2` is up to 1.5x slower (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8). -- Aside from `SonicJSON`, `JSONv2` is generally just as fast +* Aside from `SonicJSON`, `JSONv2` is generally just as fast or faster than all the alternatives. #### RawValue types ![Benchmark Unmarshal Rawvalue](benchmark-unmarshal-rawvalue.png) -- This compares performance when unmarshaling into a `json.RawValue`. +* This compares performance when unmarshaling into a `json.RawValue`. This mostly exercises the underlying decoder and hides away most of the cost of Go reflection. -- Relative to `JSONv1`, `JSONv2` is about 8.3x to 17.0x faster. -- Relative to `JSONIterator`, `JSONv2` is up to 2.0x faster. -- Relative to `SegmentJSON`, `JSONv2` is up to 1.6x faster or 1.7x slower. -- Relative to `GoJSON`, `JSONv2` is up to 1.9x faster or 2.1x slower. -- Relative to `SonicJSON`, `JSONv2` is up to 2.0x faster +* Relative to `JSONv1`, `JSONv2` is about 8.3x to 17.0x faster. +* Relative to `JSONIterator`, `JSONv2` is up to 2.0x faster. +* Relative to `SegmentJSON`, `JSONv2` is up to 1.6x faster or 1.7x slower. +* Relative to `GoJSON`, `JSONv2` is up to 1.9x faster or 2.1x slower. +* Relative to `SonicJSON`, `JSONv2` is up to 2.0x faster (ignoring `StringUnicode` since `SonicJSON` does not validate UTF-8). -- `JSONv1` takes a +* `JSONv1` takes a [lexical scanning approach](https://talks.golang.org/2011/lex.slide#1), which performs a virtual function call for every byte of input. In contrast, `JSONv2` makes heavy use of iterative and linear parsing logic (with extra complexity to resume parsing when encountering segmented buffers). -- `JSONv2` is comparable to the alternatives that use `unsafe`. +* `JSONv2` is comparable to the alternatives that use `unsafe`. Generally it is faster, but sometimes it is slower. diff --git a/vendor/modules.txt b/vendor/modules.txt index 9b417ff1..be1e831f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -155,8 +155,8 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/internal/timeseries golang.org/x/net/trace -# golang.org/x/oauth2 v0.25.0 -## explicit; go 1.18 +# golang.org/x/oauth2 v0.27.0 +## explicit; go 1.23.0 golang.org/x/oauth2 golang.org/x/oauth2/internal # golang.org/x/sync v0.10.0