core: upgrade Go requirement to 1.26.0 (#8466)

* core: upgrade Go requirement to 1.26.0

As golang 1.27 has been released, this PR
- Bump Go version requirement to 1.26.0
- Update Go build version to 1.27.0

This is also for solving the issue encountered in 8092 of k8s update

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Bump golang ci

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Migrate faillint to forbidigo, as failint has not bee updated for more than a year

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2026-09-10 19:34:44 -07:00
committed by GitHub
parent fb7e1d19fd
commit 4382b80a35
23 changed files with 99 additions and 120 deletions

View File

@@ -132,7 +132,7 @@ type dnsControlOpts struct {
}
// newdnsController creates a controller for CoreDNS.
func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsClient mcsClientset.MulticlusterV1alpha1Interface, opts dnsControlOpts) *dnsControl {
func newdnsController(_ context.Context, kubeClient kubernetes.Interface, mcsClient mcsClientset.MulticlusterV1alpha1Interface, opts dnsControlOpts) *dnsControl {
dns := dnsControl{
client: kubeClient,
mcsClient: mcsClient,
@@ -147,8 +147,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
dns.svcLister, dns.svcController = object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: serviceListFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
WatchFunc: serviceWatchFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
ListWithContextFunc: serviceListFunc(dns.client, api.NamespaceAll, dns.selector),
WatchFuncWithContext: serviceWatchFunc(dns.client, api.NamespaceAll, dns.selector),
},
kubeClient,
),
@@ -161,8 +161,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
podLister, podController := object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: podListFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
WatchFunc: podWatchFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
ListWithContextFunc: podListFunc(dns.client, api.NamespaceAll, dns.selector),
WatchFuncWithContext: podWatchFunc(dns.client, api.NamespaceAll, dns.selector),
},
kubeClient,
),
@@ -183,8 +183,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
epLister, epController := object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: endpointSliceListFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
WatchFunc: endpointSliceWatchFunc(ctx, dns.client, api.NamespaceAll, dns.selector),
ListWithContextFunc: endpointSliceListFunc(dns.client, api.NamespaceAll, dns.selector),
WatchFuncWithContext: endpointSliceWatchFunc(dns.client, api.NamespaceAll, dns.selector),
},
kubeClient,
),
@@ -201,8 +201,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
dns.nsLister, dns.nsController = object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: namespaceListFunc(ctx, dns.client, dns.namespaceSelector),
WatchFunc: namespaceWatchFunc(ctx, dns.client, dns.namespaceSelector),
ListWithContextFunc: namespaceListFunc(dns.client, dns.namespaceSelector),
WatchFuncWithContext: namespaceWatchFunc(dns.client, dns.namespaceSelector),
},
kubeClient,
),
@@ -222,8 +222,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
dns.mcEpLister, dns.mcEpController = object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: endpointSliceListFunc(ctx, dns.client, api.NamespaceAll, mcsEpSelector),
WatchFunc: endpointSliceWatchFunc(ctx, dns.client, api.NamespaceAll, mcsEpSelector),
ListWithContextFunc: endpointSliceListFunc(dns.client, api.NamespaceAll, mcsEpSelector),
WatchFuncWithContext: endpointSliceWatchFunc(dns.client, api.NamespaceAll, mcsEpSelector),
},
kubeClient,
),
@@ -235,8 +235,8 @@ func newdnsController(ctx context.Context, kubeClient kubernetes.Interface, mcsC
dns.svcImportLister, dns.svcImportController = object.NewIndexerInformer(
cache.ToListWatcherWithWatchListSemantics(
&cache.ListWatch{
ListFunc: serviceImportListFunc(ctx, dns.mcsClient, api.NamespaceAll, dns.namespaceSelector),
WatchFunc: serviceImportWatchFunc(ctx, dns.mcsClient, api.NamespaceAll, dns.namespaceSelector),
ListWithContextFunc: serviceImportListFunc(dns.mcsClient, api.NamespaceAll, dns.namespaceSelector),
WatchFuncWithContext: serviceImportWatchFunc(dns.mcsClient, api.NamespaceAll, dns.namespaceSelector),
},
kubeClient,
),
@@ -334,8 +334,8 @@ func mcEpNameNamespaceIndexFunc(obj any) ([]string, error) {
return []string{mcEp.Index}, nil
}
func serviceListFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
return func(opts meta.ListOptions) (runtime.Object, error) {
func serviceListFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (runtime.Object, error) {
return func(ctx context.Context, opts meta.ListOptions) (runtime.Object, error) {
if s != nil {
opts.LabelSelector = s.String()
}
@@ -343,8 +343,8 @@ func serviceListFunc(ctx context.Context, c kubernetes.Interface, ns string, s l
}
}
func podListFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
return func(opts meta.ListOptions) (runtime.Object, error) {
func podListFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (runtime.Object, error) {
return func(ctx context.Context, opts meta.ListOptions) (runtime.Object, error) {
if s != nil {
opts.LabelSelector = s.String()
}
@@ -356,8 +356,8 @@ func podListFunc(ctx context.Context, c kubernetes.Interface, ns string, s label
}
}
func endpointSliceListFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
return func(opts meta.ListOptions) (runtime.Object, error) {
func endpointSliceListFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (runtime.Object, error) {
return func(ctx context.Context, opts meta.ListOptions) (runtime.Object, error) {
if s != nil {
opts.LabelSelector = s.String()
}
@@ -365,8 +365,8 @@ func endpointSliceListFunc(ctx context.Context, c kubernetes.Interface, ns strin
}
}
func namespaceListFunc(ctx context.Context, c kubernetes.Interface, s labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
return func(opts meta.ListOptions) (runtime.Object, error) {
func namespaceListFunc(c kubernetes.Interface, s labels.Selector) func(context.Context, meta.ListOptions) (runtime.Object, error) {
return func(ctx context.Context, opts meta.ListOptions) (runtime.Object, error) {
if s != nil {
opts.LabelSelector = s.String()
}
@@ -374,8 +374,8 @@ func namespaceListFunc(ctx context.Context, c kubernetes.Interface, s labels.Sel
}
}
func serviceImportListFunc(ctx context.Context, c mcsClientset.MulticlusterV1alpha1Interface, ns string, s labels.Selector) func(meta.ListOptions) (runtime.Object, error) {
return func(opts meta.ListOptions) (runtime.Object, error) {
func serviceImportListFunc(c mcsClientset.MulticlusterV1alpha1Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (runtime.Object, error) {
return func(ctx context.Context, opts meta.ListOptions) (runtime.Object, error) {
if s != nil {
opts.LabelSelector = s.String()
}
@@ -383,8 +383,8 @@ func serviceImportListFunc(ctx context.Context, c mcsClientset.MulticlusterV1alp
}
}
func serviceWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
return func(options meta.ListOptions) (watch.Interface, error) {
func serviceWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (watch.Interface, error) {
return func(ctx context.Context, options meta.ListOptions) (watch.Interface, error) {
if s != nil {
options.LabelSelector = s.String()
}
@@ -392,8 +392,8 @@ func serviceWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s
}
}
func podWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
return func(options meta.ListOptions) (watch.Interface, error) {
func podWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (watch.Interface, error) {
return func(ctx context.Context, options meta.ListOptions) (watch.Interface, error) {
if s != nil {
options.LabelSelector = s.String()
}
@@ -405,8 +405,8 @@ func podWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labe
}
}
func endpointSliceWatchFunc(ctx context.Context, c kubernetes.Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
return func(options meta.ListOptions) (watch.Interface, error) {
func endpointSliceWatchFunc(c kubernetes.Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (watch.Interface, error) {
return func(ctx context.Context, options meta.ListOptions) (watch.Interface, error) {
if s != nil {
options.LabelSelector = s.String()
}
@@ -414,8 +414,8 @@ func endpointSliceWatchFunc(ctx context.Context, c kubernetes.Interface, ns stri
}
}
func namespaceWatchFunc(ctx context.Context, c kubernetes.Interface, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
return func(options meta.ListOptions) (watch.Interface, error) {
func namespaceWatchFunc(c kubernetes.Interface, s labels.Selector) func(context.Context, meta.ListOptions) (watch.Interface, error) {
return func(ctx context.Context, options meta.ListOptions) (watch.Interface, error) {
if s != nil {
options.LabelSelector = s.String()
}
@@ -423,8 +423,8 @@ func namespaceWatchFunc(ctx context.Context, c kubernetes.Interface, s labels.Se
}
}
func serviceImportWatchFunc(ctx context.Context, c mcsClientset.MulticlusterV1alpha1Interface, ns string, s labels.Selector) func(options meta.ListOptions) (watch.Interface, error) {
return func(options meta.ListOptions) (watch.Interface, error) {
func serviceImportWatchFunc(c mcsClientset.MulticlusterV1alpha1Interface, ns string, s labels.Selector) func(context.Context, meta.ListOptions) (watch.Interface, error) {
return func(ctx context.Context, options meta.ListOptions) (watch.Interface, error) {
if s != nil {
options.LabelSelector = s.String()
}

View File

@@ -11,7 +11,7 @@ import (
mcs "sigs.k8s.io/mcs-api/pkg/apis/v1alpha1"
)
func ptrTo[T any](v T) *T { return &v }
//go:fix inline
// dump renders an object for a failure message. %+v prints an aliased pointer field as
// an address, which hides the value that actually differs, so render as JSON instead.
@@ -76,7 +76,7 @@ func deepCopyCases() []struct {
Ports: []api.ServicePort{{
Name: "http", Protocol: api.ProtocolTCP, Port: 80,
// A pointer field, so a slice copy alone leaves it shared.
AppProtocol: ptrTo("kubernetes.io/h2c"),
AppProtocol: new("kubernetes.io/h2c"),
}},
ExternalIPs: []string{"1.2.3.4"},
}},
@@ -89,7 +89,7 @@ func deepCopyCases() []struct {
Type: mcs.ClusterSetIP,
Ports: []mcs.ServicePort{{
Name: "http", Protocol: api.ProtocolTCP, Port: 80,
AppProtocol: ptrTo("kubernetes.io/h2c"),
AppProtocol: new("kubernetes.io/h2c"),
}},
}},
{"Namespace", &Namespace{Version: "1", Name: "testns"}},