Skip to content

Commit 6d743f5

Browse files
upgrade to latest dependencies
Signed-off-by: Knative Automation <[email protected]>
1 parent 1656ace commit 6d743f5

File tree

33 files changed

+86
-63
lines changed

33 files changed

+86
-63
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22
2323
knative.dev/hack v0.0.0-20240607132042-09143140a254
2424
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c
25-
knative.dev/pkg v0.0.0-20240625072707-8535fcc248ae
25+
knative.dev/pkg v0.0.0-20240626134149-3f6a546ac3a4
2626
sigs.k8s.io/gateway-api v1.1.0
2727
sigs.k8s.io/yaml v1.4.0
2828
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,8 @@ knative.dev/hack v0.0.0-20240607132042-09143140a254 h1:1YFnu3U6dWZg0oxm6GU8kEdA9
681681
knative.dev/hack v0.0.0-20240607132042-09143140a254/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
682682
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c h1:Q+DdJYzvhwAVWMQtP6mbEr5dNxpr+K9HAF9RqJmZefY=
683683
knative.dev/networking v0.0.0-20240611072033-3b8764c0bb4c/go.mod h1:WhZLv94eOMDGHbdZiMrw6cnRfN3WEcFgpjUcV0A48pI=
684-
knative.dev/pkg v0.0.0-20240625072707-8535fcc248ae h1:unXplcQLqwO+QtSepyRI2zy4ZD/tciPro9Y4uVG6n6g=
685-
knative.dev/pkg v0.0.0-20240625072707-8535fcc248ae/go.mod h1:Wikg4u73T6vk9TctrxZt60VXzqmGEQIx0iKfk1+9o4c=
684+
knative.dev/pkg v0.0.0-20240626134149-3f6a546ac3a4 h1:slPKf3UKdBFZlz+hFy+KXzTgY9yOePLzRuEhKzgc5a4=
685+
knative.dev/pkg v0.0.0-20240626134149-3f6a546ac3a4/go.mod h1:Wikg4u73T6vk9TctrxZt60VXzqmGEQIx0iKfk1+9o4c=
686686
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
687687
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
688688
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=

vendor/knative.dev/pkg/apis/condition_set.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package apis
1818

1919
import (
20+
"errors"
2021
"fmt"
2122
"reflect"
2223
"sort"
@@ -233,7 +234,7 @@ func (r conditionsImpl) ClearCondition(t ConditionType) error {
233234
}
234235
// Terminal conditions are not handled as they can't be nil
235236
if r.isTerminal(t) {
236-
return fmt.Errorf("clearing terminal conditions not implemented")
237+
return errors.New("clearing terminal conditions not implemented")
237238
}
238239
cond := r.GetCondition(t)
239240
if cond == nil {

vendor/knative.dev/pkg/apis/deprecated.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func getPrefixedNamedFieldValues(prefix string, obj interface{}) (map[string]ref
9494
return fields, inlined
9595
}
9696

97-
for i := 0; i < objValue.NumField(); i++ {
97+
for i := range objValue.NumField() {
9898
tf := objValue.Type().Field(i)
9999
if v := objValue.Field(i); v.IsValid() {
100100
jTag := tf.Tag.Get("json")

vendor/knative.dev/pkg/apis/duck/v1/destination.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ func (d *Destination) SetDefaults(ctx context.Context) {
103103
}
104104
}
105105

106-
func validateCACerts(CACert *string) *apis.FieldError {
106+
func validateCACerts(caCert *string) *apis.FieldError {
107107
// Check the object.
108108
var errs *apis.FieldError
109109

110-
block, err := pem.Decode([]byte(*CACert))
110+
block, err := pem.Decode([]byte(*caCert))
111111
if err != nil && block == nil {
112112
errs = errs.Also(apis.ErrInvalidValue("CA Cert provided is invalid", "caCert"))
113113
return errs

vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ func (kr *KReference) Validate(ctx context.Context) *apis.FieldError {
102102
Details: fmt.Sprintf("parent namespace: %q does not match ref: %q", parentNS, kr.Namespace),
103103
})
104104
}
105-
106105
}
107106
}
108107
return errs

vendor/knative.dev/pkg/apis/duck/v1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
5252
(&KResource{}).GetListType(),
5353
&AddressableType{},
5454
(&AddressableType{}).GetListType(),
55+
&AuthenticatableType{},
56+
(&AuthenticatableType{}).GetListType(),
5557
&Source{},
5658
(&Source{}).GetListType(),
5759
&WithPod{},

vendor/knative.dev/pkg/apis/duck/v1/status_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ func (s *Status) ConvertTo(ctx context.Context, sink *Status, predicates ...func
9797

9898
conditions := make(apis.Conditions, 0, len(s.Conditions))
9999
for _, c := range s.Conditions {
100-
101100
// Copy over the "happy" condition, which is the only condition that
102101
// we can reliably transfer.
103102
if c.Type == apis.ConditionReady || c.Type == apis.ConditionSucceeded {

vendor/knative.dev/pkg/apis/kind2resource.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package apis
1818

1919
import (
20-
"fmt"
2120
"strings"
2221

2322
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -41,7 +40,7 @@ func KindToResource(gvk schema.GroupVersionKind) schema.GroupVersionResource {
4140
func pluralizeKind(kind string) string {
4241
ret := strings.ToLower(kind)
4342
if strings.HasSuffix(ret, "s") {
44-
return fmt.Sprintf("%ses", ret)
43+
return ret + "es"
4544
}
46-
return fmt.Sprintf("%ss", ret)
45+
return ret + "s"
4746
}

vendor/knative.dev/pkg/codegen/cmd/injection-gen/args/args.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package args
1818

1919
import (
20-
"fmt"
20+
"errors"
2121

2222
"github.com/spf13/pflag"
2323
"k8s.io/gengo/args"
@@ -59,13 +59,13 @@ func Validate(genericArgs *args.GeneratorArgs) error {
5959
customArgs := genericArgs.CustomArgs.(*CustomArgs)
6060

6161
if len(genericArgs.OutputPackagePath) == 0 {
62-
return fmt.Errorf("output package cannot be empty")
62+
return errors.New("output package cannot be empty")
6363
}
6464
if len(customArgs.VersionedClientSetPackage) == 0 {
65-
return fmt.Errorf("versioned clientset package cannot be empty")
65+
return errors.New("versioned clientset package cannot be empty")
6666
}
6767
if len(customArgs.ExternalVersionsInformersPackage) == 0 {
68-
return fmt.Errorf("external versions informers package cannot be empty")
68+
return errors.New("external versions informers package cannot be empty")
6969
}
7070

7171
return nil

vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/packages.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
4343
klog.Fatalf("Wrong CustomArgs type: %T", arguments.CustomArgs)
4444
}
4545

46-
versionPackagePath := filepath.Join(arguments.OutputPackagePath)
46+
versionPackagePath := filepath.Clean(arguments.OutputPackagePath)
4747

4848
var packageList generator.Packages
4949

@@ -389,8 +389,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg
389389
vers := make([]generator.Package, 0, 2*len(typesToGenerate))
390390

391391
for _, t := range typesToGenerate {
392-
// Fix for golang iterator bug.
393-
t := t
394392
packagePath := packagePath + "/" + strings.ToLower(t.Name.Name)
395393
typedInformerPackage := typedInformerPackage(groupPkgName, gv, customArgs.ExternalVersionsInformersPackage)
396394

@@ -501,7 +499,6 @@ func versionInformerPackages(basePackage string, groupPkgName string, gv clientg
501499
return tags.NeedsInformerInjection()
502500
},
503501
})
504-
505502
}
506503
return vers
507504
}
@@ -513,8 +510,6 @@ func reconcilerPackages(basePackage string, groupPkgName string, gv clientgentyp
513510
vers := make([]generator.Package, 0, 4*len(typesToGenerate))
514511

515512
for _, t := range typesToGenerate {
516-
// Fix for golang iterator bug.
517-
t := t
518513
extracted := extractCommentTags(t)
519514
reconcilerClasses, hasReconcilerClass := extractReconcilerClassesTag(extracted)
520515
nonNamespaced := isNonNamespaced(extracted)
@@ -677,7 +672,6 @@ func versionDuckPackages(basePackage string, groupPkgName string, gv clientgenty
677672

678673
for _, t := range typesToGenerate {
679674
// Fix for golang iterator bug.
680-
t := t
681675
packagePath := filepath.Join(packagePath, strings.ToLower(t.Name.Name))
682676

683677
// Impl

vendor/knative.dev/pkg/configmap/filter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package configmap
1818

1919
import (
20-
"fmt"
20+
"errors"
2121
"reflect"
2222

2323
corev1 "k8s.io/api/core/v1"
@@ -58,17 +58,17 @@ func ValidateConstructor(constructor interface{}) error {
5858
cType := reflect.TypeOf(constructor)
5959

6060
if cType.Kind() != reflect.Func {
61-
return fmt.Errorf("config constructor must be a function")
61+
return errors.New("config constructor must be a function")
6262
}
6363

6464
if cType.NumIn() != 1 || cType.In(0) != reflect.TypeOf(&corev1.ConfigMap{}) {
65-
return fmt.Errorf("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)")
65+
return errors.New("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)")
6666
}
6767

6868
errorType := reflect.TypeOf((*error)(nil)).Elem()
6969

7070
if cType.NumOut() != 2 || !cType.Out(1).Implements(errorType) {
71-
return fmt.Errorf("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)")
71+
return errors.New("config constructor must be of the type func(*k8s.io/api/core/v1/ConfigMap) (..., error)")
7272
}
7373
return nil
7474
}

vendor/knative.dev/pkg/configmap/informer/synced_callback.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ limitations under the License.
1717
package informer
1818

1919
import (
20+
"context"
2021
"sync"
2122

2223
"k8s.io/apimachinery/pkg/util/sets"
23-
"k8s.io/apimachinery/pkg/util/wait"
2424
)
2525

2626
// namedWaitGroup is used to increment and decrement a WaitGroup by name
@@ -107,6 +107,6 @@ func (s *syncedCallback) WaitForAllKeys(stopCh <-chan struct{}) error {
107107
case <-c:
108108
return nil
109109
case <-stopCh:
110-
return wait.ErrWaitTimeout
110+
return context.DeadlineExceeded
111111
}
112112
}

vendor/knative.dev/pkg/controller/controller.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ type Impl struct {
224224

225225
// ControllerOptions encapsulates options for creating a new controller,
226226
// including throttling and stats behavior.
227-
type ControllerOptions struct { //nolint // for backcompat.
227+
type ControllerOptions struct {
228228
WorkQueueName string
229229
Logger *zap.SugaredLogger
230230
Reporter StatsReporter
@@ -482,7 +482,7 @@ func (c *Impl) RunContext(ctx context.Context, threadiness int) error {
482482

483483
// Launch workers to process resources that get enqueued to our workqueue.
484484
c.logger.Info("Starting controller and workers")
485-
for i := 0; i < threadiness; i++ {
485+
for range threadiness {
486486
sg.Add(1)
487487
go func() {
488488
defer sg.Done()
@@ -623,7 +623,6 @@ func IsSkipKey(err error) bool {
623623
// Is implements the Is() interface of error. It returns whether the target
624624
// error can be treated as equivalent to a permanentError.
625625
func (skipKeyError) Is(target error) bool {
626-
//nolint: errorlint // This check is actually fine.
627626
_, ok := target.(skipKeyError)
628627
return ok
629628
}
@@ -650,7 +649,6 @@ func IsPermanentError(err error) bool {
650649
// Is implements the Is() interface of error. It returns whether the target
651650
// error can be treated as equivalent to a permanentError.
652651
func (permanentError) Is(target error) bool {
653-
//nolint: errorlint // This check is actually fine.
654652
_, ok := target.(permanentError)
655653
return ok
656654
}
@@ -710,7 +708,6 @@ func IsRequeueKey(err error) (bool, time.Duration) {
710708
// Is implements the Is() interface of error. It returns whether the target
711709
// error can be treated as equivalent to a requeueKeyError.
712710
func (requeueKeyError) Is(target error) bool {
713-
//nolint: errorlint // This check is actually fine.
714711
_, ok := target.(requeueKeyError)
715712
return ok
716713
}
@@ -726,7 +723,6 @@ type Informer interface {
726723
// of them to synchronize.
727724
func StartInformers(stopCh <-chan struct{}, informers ...Informer) error {
728725
for _, informer := range informers {
729-
informer := informer
730726
go informer.Run(stopCh)
731727
}
732728

@@ -744,7 +740,6 @@ func RunInformers(stopCh <-chan struct{}, informers ...Informer) (func(), error)
744740
var wg sync.WaitGroup
745741
wg.Add(len(informers))
746742
for _, informer := range informers {
747-
informer := informer
748743
go func() {
749744
defer wg.Done()
750745
informer.Run(stopCh)
@@ -762,16 +757,16 @@ func RunInformers(stopCh <-chan struct{}, informers ...Informer) (func(), error)
762757
// WaitForCacheSyncQuick is the same as cache.WaitForCacheSync but with a much reduced
763758
// check-rate for the sync period.
764759
func WaitForCacheSyncQuick(stopCh <-chan struct{}, cacheSyncs ...cache.InformerSynced) bool {
765-
err := wait.PollImmediateUntil(time.Millisecond,
766-
func() (bool, error) {
760+
err := wait.PollUntilContextCancel(wait.ContextForChannel(stopCh), time.Millisecond, true,
761+
func(context.Context) (bool, error) {
767762
for _, syncFunc := range cacheSyncs {
768763
if !syncFunc() {
769764
return false, nil
770765
}
771766
}
772767
return true, nil
773768
},
774-
stopCh)
769+
)
775770
return err == nil
776771
}
777772

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2024 The Knative Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
22+
go run mvdan.cc/gofumpt@latest -l -w .
23+

vendor/knative.dev/pkg/injection/informers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
//nolint:fatcontext
1718
package injection
1819

1920
import (
@@ -93,7 +94,6 @@ func (i *impl) SetupInformers(ctx context.Context, cfg *rest.Config) (context.Co
9394
for _, fii := range i.GetFilteredInformers() {
9495
ctx, filteredinfs = fii(ctx)
9596
informers = append(informers, filteredinfs...)
96-
9797
}
9898
return ctx, informers
9999
}

vendor/knative.dev/pkg/kmeta/names.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package kmeta
1818

1919
import (
2020
"crypto/md5" //nolint:gosec // No strong cryptography needed.
21+
"encoding/hex"
2122
"fmt"
2223
"regexp"
2324
)
@@ -53,7 +54,7 @@ func ChildName(parent, suffix string) string {
5354
// Format the return string, if it's shorter than longest: pad with
5455
// beginning of the suffix. This happens, for example, when parent is
5556
// short, but the suffix is very long.
56-
ret := parent + fmt.Sprintf("%x", h)
57+
ret := parent + hex.EncodeToString(h[:])
5758
if d := longest - len(ret); d > 0 {
5859
ret += suffix[:d]
5960
}

vendor/knative.dev/pkg/leaderelection/chaosduck/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func main() {
153153
continue
154154
}
155155

156-
name, leaders := name, leaders
157156
eg.Go(func() error {
158157
return quack(ctx, kc, name, leaders)
159158
})

vendor/knative.dev/pkg/leaderelection/context.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ func (b *standardBuilder) buildElector(ctx context.Context, la reconciler.Leader
133133
bkts := newStandardBuckets(queueName, b.lec)
134134
electors := make([]Elector, 0, b.lec.Buckets)
135135
for _, bkt := range bkts {
136-
// Use a local var which won't change across the for loop since it is
137-
// used in a callback asynchronously.
138-
bkt := bkt
139136
rl, err := resourcelock.New(knativeResourceLock,
140137
system.Namespace(), // use namespace we are running in
141138
bkt.Name(),
@@ -192,7 +189,7 @@ func newStandardBuckets(queueName string, cc ComponentConfig) []reconciler.Bucke
192189
}
193190
}
194191
names := make(sets.Set[string], cc.Buckets)
195-
for i := uint32(0); i < cc.Buckets; i++ {
192+
for i := range cc.Buckets {
196193
names.Insert(ln(i))
197194
}
198195

@@ -239,7 +236,7 @@ func NewStatefulSetBucketAndSet(buckets int) (reconciler.Bucket, *hash.BucketSet
239236
}
240237

241238
names := make(sets.Set[string], buckets)
242-
for i := 0; i < buckets; i++ {
239+
for i := range buckets {
243240
names.Insert(statefulSetPodDNS(i, ssc))
244241
}
245242

0 commit comments

Comments
 (0)