Skip to content

Commit

Permalink
bump knative.dev/pkg to pull in nil pointer fixes (knative#13500)
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso authored and nak3 committed Mar 3, 2023
1 parent d36d0b3 commit 2fceb54
Show file tree
Hide file tree
Showing 32 changed files with 211 additions and 185 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
knative.dev/control-protocol v0.0.0-20221017021456-3e2f8785943b
knative.dev/hack v0.0.0-20221010154335-3fdc50b9c24a
knative.dev/networking v0.0.0-20221012062251-58f3e6239b4f
knative.dev/pkg v0.0.0-20221011175852-714b7630a836
knative.dev/pkg v0.0.0-20221123011842-b78020c16606
sigs.k8s.io/yaml v1.3.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1667,8 +1667,8 @@ knative.dev/hack v0.0.0-20221010154335-3fdc50b9c24a h1:yfq1OMrkyYkxDeM0pmAOeN4YF
knative.dev/hack v0.0.0-20221010154335-3fdc50b9c24a/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/networking v0.0.0-20221012062251-58f3e6239b4f h1:e/08+ofUjGjSYV2Usvb22IbkX4MjoiywbRtnXUK3FQY=
knative.dev/networking v0.0.0-20221012062251-58f3e6239b4f/go.mod h1:GciicKYf4aWE138pT2ZKkZ/E10rd0Kt4ziX52A/HnVY=
knative.dev/pkg v0.0.0-20221011175852-714b7630a836 h1:0N7Zo/O+xeUUebJPm9keBaGclrUoEbljr3J1MsqtaIM=
knative.dev/pkg v0.0.0-20221011175852-714b7630a836/go.mod h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8=
knative.dev/pkg v0.0.0-20221123011842-b78020c16606 h1:bHozIhJtQE9/SVQkVX2vqnoJGJt6zo7J0jnkLFX3Crw=
knative.dev/pkg v0.0.0-20221123011842-b78020c16606/go.mod h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8=
mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
Expand Down
6 changes: 3 additions & 3 deletions vendor/knative.dev/pkg/apis/duck/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ type Populatable = ducktypes.Populatable
// the provided Implementable duck type. It is expected that under the resource
// definition implementing a particular "Fooable" that one would write:
//
// type ConcreteResource struct { ... }
// type ConcreteResource struct { ... }
//
// // Check that ConcreteResource properly implement Fooable.
// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{})
// // Check that ConcreteResource properly implement Fooable.
// err := duck.VerifyType(&ConcreteResource{}, &something.Fooable{})
//
// This will return an error if the duck typing is not satisfied.
func VerifyType(instance interface{}, iface Implementable) error {
Expand Down
52 changes: 29 additions & 23 deletions vendor/knative.dev/pkg/apis/field_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
Expand All @@ -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))
}
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -282,10 +287,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 {
Expand Down
16 changes: 8 additions & 8 deletions vendor/knative.dev/pkg/apis/testing/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ var Funcs = fuzzer.MergeFuzzerFuncs(
// Consumers should initialize their conditions prior to fuzzing them.
// For example:
//
// func(s *SomeStatus, c fuzz.Continue) {
// c.FuzzNoCustom(s) // fuzz the status object
// func(s *SomeStatus, c fuzz.Continue) {
// c.FuzzNoCustom(s) // fuzz the status object
//
// // Clear the random fuzzed condition
// s.Status.SetConditions(nil)
// // Clear the random fuzzed condition
// s.Status.SetConditions(nil)
//
// // Fuzz the known conditions except their type value
// s.InitializeConditions()
// fuzz.Conditions(&s.Status, c)
// }
// // Fuzz the known conditions except their type value
// s.InitializeConditions()
// fuzz.Conditions(&s.Status, c)
// }
func FuzzConditions(accessor apis.ConditionsAccessor, c fuzz.Continue) {
conds := accessor.GetConditions()
for i, cond := range conds {
Expand Down
6 changes: 2 additions & 4 deletions vendor/knative.dev/pkg/apis/testing/roundtrip/roundtrip.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ func init() {
// ExternalTypesViaJSON applies the round-trip test to all external round-trippable Kinds
// in the scheme. This is effectively testing the scenario:
//
// external -> json -> external
//
// external -> json -> external
func ExternalTypesViaJSON(t *testing.T, scheme *runtime.Scheme, fuzzerFuncs fuzzer.FuzzerFuncs) {
codecFactory := serializer.NewCodecFactory(scheme)

Expand All @@ -114,8 +113,7 @@ func ExternalTypesViaJSON(t *testing.T, scheme *runtime.Scheme, fuzzerFuncs fuzz
// ExternalTypesViaHub applies the round-trip test to all external round-trippable Kinds
// in the scheme. This is effectively testing the scenario:
//
// external version -> hub version -> external version
//
// external version -> hub version -> external version
func ExternalTypesViaHub(t *testing.T, scheme, hubs *runtime.Scheme, fuzzerFuncs fuzzer.FuzzerFuncs) {
f := fuzzer.FuzzerFor(
fuzzer.MergeFuzzerFuncs(metafuzzer.Funcs, fuzzerFuncs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -27,28 +27,30 @@ type CommentTag map[string][]string

// ExtractCommentTags parses comments for lines of the form:
//
// "marker" + "prefix" + ':' + "key=value,key2=value2".
// "marker" + "prefix" + ':' + "key=value,key2=value2".
//
// In the following example the marker is '+' and the prefix is 'foo':
// +foo:key=value1,key2=value2,key=value3
// In the following example the marker is '+' and the prefix is 'foo':
// +foo:key=value1,key2=value2,key=value3
//
// Values are optional; empty map is the default. A tag can be specified more than
// one time and all values are returned. If the resulting map has an entry for
// a key, the value (a slice) is guaranteed to have at least 1 element.
//
// Example: if you pass "+" for 'marker', and the following lines are in
// the comments:
// +foo:key=value1,key2=value2,key=value3
// +bar
//
// +foo:key=value1,key2=value2,key=value3
// +bar
//
// Then this function will return:
// map[string]map[string]string{
// "foo":{
// "key": []string{"value1", "value3"},
// "key2": []string{"value2"}
// },
// "bar": {},
// }
//
// map[string]map[string]string{
// "foo":{
// "key": []string{"value1", "value3"},
// "key2": []string{"value2"}
// },
// "bar": {},
// }
//
// Users are not expected to repeat values.
func ExtractCommentTags(marker string, lines []string) CommentTags {
Expand Down
4 changes: 2 additions & 2 deletions vendor/knative.dev/pkg/configmap/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ limitations under the License.

// Package configmap exists to facilitate consuming Kubernetes ConfigMap
// resources in various ways, including:
// - Watching them for changes over time, and
// - Loading them from a VolumeMount.
// - Watching them for changes over time, and
// - Loading them from a VolumeMount.
package configmap
4 changes: 2 additions & 2 deletions vendor/knative.dev/pkg/configmap/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Logger interface {
// Constructors is a map for specifying configmap names to
// their function constructors
//
// The values of this map must be functions with the definition
// # The values of this map must be functions with the definition
//
// func(*k8s.io/api/core/v1.ConfigMap) (... , error)
//
Expand All @@ -60,7 +60,7 @@ type UntypedStore struct {
// NewUntypedStore creates an UntypedStore with given name,
// Logger and Constructors
//
// The Logger must not be nil
// # The Logger must not be nil
//
// The values in the Constructors map must be functions with
// the definition
Expand Down
8 changes: 5 additions & 3 deletions vendor/knative.dev/pkg/depcheck/depcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ func (g graph) order() []string {
}

// path constructs an examplary path that looks something like:
// knative.dev/pkg/apis/duck
// knative.dev/pkg/apis # Also: [knative.dev/pkg/kmeta knative.dev/pkg/tracker]
// k8s.io/api/core/v1
//
// knative.dev/pkg/apis/duck
// knative.dev/pkg/apis # Also: [knative.dev/pkg/kmeta knative.dev/pkg/tracker]
// k8s.io/api/core/v1
//
// See the failing example in the test file.
func (g graph) path(name string) []string {
n := g[name]
Expand Down
16 changes: 8 additions & 8 deletions vendor/knative.dev/pkg/hash/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ limitations under the License.

// Package hash contains various Knative specific hashing utilities.
//
// - ChooseSubset is a consistent hashing/mapping function providing
// a consistent selection of N keys from M (N<=M) keys for a given
// target.
// - BucketSet is a bucketer library which uses ChooseSubset under the
// the hood in order to implement consistent mapping between keys and
// set of buckets, identified by unique names. Compared to basic bucket
// implementation which just does hash%num_buckets, when the number of
// buckets change only a small subset of keys are supposed to migrate.
// - ChooseSubset is a consistent hashing/mapping function providing
// a consistent selection of N keys from M (N<=M) keys for a given
// target.
// - BucketSet is a bucketer library which uses ChooseSubset under the
// the hood in order to implement consistent mapping between keys and
// set of buckets, identified by unique names. Compared to basic bucket
// implementation which just does hash%num_buckets, when the number of
// buckets change only a small subset of keys are supposed to migrate.
package hash
Loading

0 comments on commit 2fceb54

Please sign in to comment.