update dependencies (#6267)
Signed-off-by: hongming <coder.scala@gmail.com>
This commit is contained in:
2
vendor/github.com/go-openapi/errors/.golangci.yml
generated
vendored
2
vendor/github.com/go-openapi/errors/.golangci.yml
generated
vendored
@@ -44,5 +44,3 @@ linters:
|
||||
- cyclop
|
||||
- errname
|
||||
- varnamelen
|
||||
- exhaustruct
|
||||
- maintidx
|
||||
|
||||
3
vendor/github.com/go-openapi/errors/api.go
generated
vendored
3
vendor/github.com/go-openapi/errors/api.go
generated
vendored
@@ -99,7 +99,6 @@ func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
|
||||
func errorAsJSON(err Error) []byte {
|
||||
//nolint:errchkjson
|
||||
b, _ := json.Marshal(struct {
|
||||
Code int32 `json:"code"`
|
||||
Message string `json:"message"`
|
||||
@@ -147,7 +146,7 @@ func ServeError(rw http.ResponseWriter, r *http.Request, err error) {
|
||||
ServeError(rw, r, nil)
|
||||
}
|
||||
case *MethodNotAllowedError:
|
||||
rw.Header().Add("Allow", strings.Join(e.Allowed, ","))
|
||||
rw.Header().Add("Allow", strings.Join(err.(*MethodNotAllowedError).Allowed, ","))
|
||||
rw.WriteHeader(asHTTPCode(int(e.Code())))
|
||||
if r == nil || r.Method != http.MethodHead {
|
||||
_, _ = rw.Write(errorAsJSON(e))
|
||||
|
||||
2
vendor/github.com/go-openapi/errors/doc.go
generated
vendored
2
vendor/github.com/go-openapi/errors/doc.go
generated
vendored
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
/*
|
||||
|
||||
Package errors provides an Error interface and several concrete types
|
||||
implementing this interface to manage API errors and JSON-schema validation
|
||||
errors.
|
||||
@@ -22,5 +23,6 @@ it defines.
|
||||
|
||||
It is used throughout the various go-openapi toolkit libraries
|
||||
(https://github.com/go-openapi).
|
||||
|
||||
*/
|
||||
package errors
|
||||
|
||||
1
vendor/github.com/go-openapi/errors/middleware.go
generated
vendored
1
vendor/github.com/go-openapi/errors/middleware.go
generated
vendored
@@ -28,6 +28,7 @@ type APIVerificationFailed struct {
|
||||
MissingRegistration []string `json:"missingRegistration,omitempty"`
|
||||
}
|
||||
|
||||
//
|
||||
func (v *APIVerificationFailed) Error() string {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
|
||||
|
||||
16
vendor/github.com/go-openapi/swag/util.go
generated
vendored
16
vendor/github.com/go-openapi/swag/util.go
generated
vendored
@@ -341,12 +341,21 @@ type zeroable interface {
|
||||
// IsZero returns true when the value passed into the function is a zero value.
|
||||
// This allows for safer checking of interface values.
|
||||
func IsZero(data interface{}) bool {
|
||||
v := reflect.ValueOf(data)
|
||||
// check for nil data
|
||||
switch v.Kind() {
|
||||
case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
|
||||
if v.IsNil() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// check for things that have an IsZero method instead
|
||||
if vv, ok := data.(zeroable); ok {
|
||||
return vv.IsZero()
|
||||
}
|
||||
|
||||
// continue with slightly more complex reflection
|
||||
v := reflect.ValueOf(data)
|
||||
switch v.Kind() {
|
||||
case reflect.String:
|
||||
return v.Len() == 0
|
||||
@@ -358,14 +367,13 @@ func IsZero(data interface{}) bool {
|
||||
return v.Uint() == 0
|
||||
case reflect.Float32, reflect.Float64:
|
||||
return v.Float() == 0
|
||||
case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
|
||||
return v.IsNil()
|
||||
case reflect.Struct, reflect.Array:
|
||||
return reflect.DeepEqual(data, reflect.Zero(v.Type()).Interface())
|
||||
case reflect.Invalid:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// AddInitialisms add additional initialisms
|
||||
|
||||
Reference in New Issue
Block a user