mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#695)
bumping knative.dev/pkg 6ce976c...198b463: > 198b463 Cleanup: Turn multiple warnings into multiple warnings. (# 2619) > 728dfd8 Add FieldError#WrappedErrors to allow dependent code to have access (readonly) (# 2618) Signed-off-by: Knative Automation <automation@knative.team> Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
33f18a6a8d
commit
037b71c122
2
go.mod
2
go.mod
|
@ -12,7 +12,7 @@ require (
|
|||
k8s.io/code-generator v0.25.2
|
||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1
|
||||
knative.dev/hack v0.0.0-20221024013916-9d2ae47c16b2
|
||||
knative.dev/pkg v0.0.0-20221025200856-6ce976ce9255
|
||||
knative.dev/pkg v0.0.0-20221027173407-198b4637065d
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -803,8 +803,8 @@ k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed h1:jAne/RjBTyawwAy0utX5eqigAwz/l
|
|||
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
|
||||
knative.dev/hack v0.0.0-20221024013916-9d2ae47c16b2 h1:DvWcy2c6wvjDo+rPRWe9Rn5QEH8fiq/j4QWOka0wMvQ=
|
||||
knative.dev/hack v0.0.0-20221024013916-9d2ae47c16b2/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/pkg v0.0.0-20221025200856-6ce976ce9255 h1:zTqomdMAkcKojViE1zh7AYhmJRaL9GYzMhmXhFPZxA8=
|
||||
knative.dev/pkg v0.0.0-20221025200856-6ce976ce9255/go.mod h1:j5kO7gKmWGj2DJpefCEiPbItToiYf+2bCtI+A6REkQo=
|
||||
knative.dev/pkg v0.0.0-20221027173407-198b4637065d h1:sqnBiIFVRo/TWxMNF+gNgwFM2JVdWQKtrtwidTVi5Zk=
|
||||
knative.dev/pkg v0.0.0-20221027173407-198b4637065d/go.mod h1:j5kO7gKmWGj2DJpefCEiPbItToiYf+2bCtI+A6REkQo=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
|
|
@ -83,11 +83,12 @@ var _ error = (*FieldError)(nil)
|
|||
|
||||
// ViaField is used to propagate a validation error along a field access.
|
||||
// For example, if a type recursively validates its "spec" via:
|
||||
// if err := foo.Spec.Validate(); err != nil {
|
||||
// // Augment any field paths with the context that they were accessed
|
||||
// // via "spec".
|
||||
// return err.ViaField("spec")
|
||||
// }
|
||||
//
|
||||
// if err := foo.Spec.Validate(); err != nil {
|
||||
// // Augment any field paths with the context that they were accessed
|
||||
// // via "spec".
|
||||
// return err.ViaField("spec")
|
||||
// }
|
||||
func (fe *FieldError) ViaField(prefix ...string) *FieldError {
|
||||
if fe == nil {
|
||||
return nil
|
||||
|
@ -114,11 +115,12 @@ func (fe *FieldError) ViaField(prefix ...string) *FieldError {
|
|||
|
||||
// ViaIndex is used to attach an index to the next ViaField provided.
|
||||
// For example, if a type recursively validates a parameter that has a collection:
|
||||
// for i, c := range spec.Collection {
|
||||
// if err := doValidation(c); err != nil {
|
||||
// return err.ViaIndex(i).ViaField("collection")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for i, c := range spec.Collection {
|
||||
// if err := doValidation(c); err != nil {
|
||||
// return err.ViaIndex(i).ViaField("collection")
|
||||
// }
|
||||
// }
|
||||
func (fe *FieldError) ViaIndex(index int) *FieldError {
|
||||
return fe.ViaField(asIndex(index))
|
||||
}
|
||||
|
@ -130,11 +132,12 @@ func (fe *FieldError) ViaFieldIndex(field string, index int) *FieldError {
|
|||
|
||||
// ViaKey is used to attach a key to the next ViaField provided.
|
||||
// For example, if a type recursively validates a parameter that has a collection:
|
||||
// for k, v := range spec.Bag {
|
||||
// if err := doValidation(v); err != nil {
|
||||
// return err.ViaKey(k).ViaField("bag")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for k, v := range spec.Bag {
|
||||
// if err := doValidation(v); err != nil {
|
||||
// return err.ViaKey(k).ViaField("bag")
|
||||
// }
|
||||
// }
|
||||
func (fe *FieldError) ViaKey(key string) *FieldError {
|
||||
return fe.ViaField(asKey(key))
|
||||
}
|
||||
|
@ -145,7 +148,8 @@ func (fe *FieldError) ViaFieldKey(field, key string) *FieldError {
|
|||
}
|
||||
|
||||
// At is a way to alter the level of the diagnostics held in this FieldError.
|
||||
// ErrMissingField("foo").At(WarningLevel)
|
||||
//
|
||||
// ErrMissingField("foo").At(WarningLevel)
|
||||
func (fe *FieldError) At(l DiagnosticLevel) *FieldError {
|
||||
if fe == nil {
|
||||
return nil
|
||||
|
@ -166,9 +170,10 @@ func (fe *FieldError) At(l DiagnosticLevel) *FieldError {
|
|||
}
|
||||
|
||||
// Filter is a way to access the set of diagnostics having a particular level.
|
||||
// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil {
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// if err := x.Validate(ctx).Filter(ErrorLevel); err != nil {
|
||||
// return err
|
||||
// }
|
||||
func (fe *FieldError) Filter(l DiagnosticLevel) *FieldError {
|
||||
if fe == nil {
|
||||
return nil
|
||||
|
@ -251,10 +256,15 @@ func (fe *FieldError) normalized() []*FieldError {
|
|||
return errors
|
||||
}
|
||||
|
||||
// WrappedErrors returns the value of the errors after normalizing and deduping using merge().
|
||||
func (fe *FieldError) WrappedErrors() []*FieldError {
|
||||
return merge(fe.normalized())
|
||||
}
|
||||
|
||||
// Error implements error
|
||||
func (fe *FieldError) Error() string {
|
||||
// Get the list of errors as a flat merged list.
|
||||
normedErrors := merge(fe.normalized())
|
||||
normedErrors := fe.WrappedErrors()
|
||||
errs := make([]string, 0, len(normedErrors))
|
||||
for _, e := range normedErrors {
|
||||
if e.Details == "" {
|
||||
|
@ -282,10 +292,11 @@ func asKey(key string) string {
|
|||
|
||||
// flatten takes in a array of path components and looks for chances to flatten
|
||||
// objects that have index prefixes, examples:
|
||||
// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0]
|
||||
// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar
|
||||
// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar
|
||||
// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar
|
||||
//
|
||||
// err([0]).ViaField(bar).ViaField(foo) -> foo.bar.[0] converts to foo.bar[0]
|
||||
// err(bar).ViaIndex(0).ViaField(foo) -> foo.[0].bar converts to foo[0].bar
|
||||
// err(bar).ViaField(foo).ViaIndex(0) -> [0].foo.bar converts to [0].foo.bar
|
||||
// err(bar).ViaIndex(0).ViaIndex(1).ViaField(foo) -> foo.[1].[0].bar converts to foo[1][0].bar
|
||||
func flatten(path []string) string {
|
||||
var newPath []string
|
||||
for _, part := range path {
|
||||
|
|
|
@ -690,7 +690,7 @@ k8s.io/utils/trace
|
|||
# knative.dev/hack v0.0.0-20221024013916-9d2ae47c16b2
|
||||
## explicit; go 1.18
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20221025200856-6ce976ce9255
|
||||
# knative.dev/pkg v0.0.0-20221027173407-198b4637065d
|
||||
## explicit; go 1.18
|
||||
knative.dev/pkg/apis
|
||||
knative.dev/pkg/apis/duck
|
||||
|
|
Loading…
Reference in New Issue