From a2ff5c93c7f35ce5b13d583aa5f2a5efa1150161 Mon Sep 17 00:00:00 2001 From: cpanato Date: Wed, 15 Jan 2025 09:54:32 +0100 Subject: [PATCH 1/3] bump release job to use go1.23 Signed-off-by: cpanato --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccb6e6ae..c04d5f51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Go uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: - go-version: '1.22' + go-version: '1.23' check-latest: true - name: Run GoReleaser From 9d99c16ff8eaa16280d1097c0eda5d89a522eeba Mon Sep 17 00:00:00 2001 From: cpanato Date: Wed, 15 Jan 2025 09:55:01 +0100 Subject: [PATCH 2/3] bump golanci-lint to v1.63.4 Signed-off-by: cpanato --- hack/verify-golangci-lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/verify-golangci-lint.sh b/hack/verify-golangci-lint.sh index ac008465..c9c2dd98 100755 --- a/hack/verify-golangci-lint.sh +++ b/hack/verify-golangci-lint.sh @@ -18,7 +18,7 @@ set -o errexit set -o nounset set -o pipefail -VERSION=v1.58.0 +VERSION=v1.63.4 URL_BASE=https://raw.githubusercontent.com/golangci/golangci-lint URL=$URL_BASE/$VERSION/install.sh From 0a7c5a4dc6afdc54e6da188570d0c986dbdb635f Mon Sep 17 00:00:00 2001 From: cpanato Date: Wed, 15 Jan 2025 09:55:14 +0100 Subject: [PATCH 3/3] fix lints Signed-off-by: cpanato --- klient/wait/conditions/conditions.go | 12 ++++++------ klient/wait/wait_test.go | 6 +++--- pkg/env/action_test.go | 2 +- pkg/env/env_test.go | 10 +++++----- pkg/envfuncs/kind_funcs.go | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/klient/wait/conditions/conditions.go b/klient/wait/conditions/conditions.go index e7d04927..0154ada1 100644 --- a/klient/wait/conditions/conditions.go +++ b/klient/wait/conditions/conditions.go @@ -208,7 +208,7 @@ func (c *Condition) JobConditionMatch(job k8s.Object, conditionType batchv1.JobC if err := c.resources.Get(ctx, job.GetName(), job.GetNamespace(), job); err != nil { return false, err } - status := job.(*batchv1.Job).Status + status := job.(*batchv1.Job).Status // nolint: errcheck log.V(4).InfoS("Current Status of the job resource", "status", status) for _, cond := range status.Conditions { if cond.Type == conditionType && cond.Status == conditionState { @@ -225,7 +225,7 @@ func (c *Condition) DeploymentConditionMatch(deployment k8s.Object, conditionTyp if err := c.resources.Get(ctx, deployment.GetName(), deployment.GetNamespace(), deployment); err != nil { return false, err } - for _, cond := range deployment.(*appsv1.Deployment).Status.Conditions { + for _, cond := range deployment.(*appsv1.Deployment).Status.Conditions { // nolint: errcheck if cond.Type == conditionType && cond.Status == conditionState { done = true } @@ -242,7 +242,7 @@ func (c *Condition) PodConditionMatch(pod k8s.Object, conditionType v1.PodCondit if err := c.resources.Get(ctx, pod.GetName(), pod.GetNamespace(), pod); err != nil { return false, err } - status := pod.(*v1.Pod).Status + status := pod.(*v1.Pod).Status // nolint: errcheck log.V(4).InfoS("Current Status of the pod resource", "status", status) for _, cond := range status.Conditions { if cond.Type == conditionType && cond.Status == conditionState { @@ -262,8 +262,8 @@ func (c *Condition) PodPhaseMatch(pod k8s.Object, phase v1.PodPhase) apimachiner if err := c.resources.Get(context.Background(), pod.GetName(), pod.GetNamespace(), pod); err != nil { return false, err } - log.V(4).InfoS("Current phase", "phase", pod.(*v1.Pod).Status.Phase) - return pod.(*v1.Pod).Status.Phase == phase, nil + log.V(4).InfoS("Current phase", "phase", pod.(*v1.Pod).Status.Phase) // nolint: errcheck + return pod.(*v1.Pod).Status.Phase == phase, nil // nolint: errcheck } } @@ -310,7 +310,7 @@ func (c *Condition) DaemonSetReady(daemonset k8s.Object) apimachinerywait.Condit if err := c.resources.Get(ctx, daemonset.GetName(), daemonset.GetNamespace(), daemonset); err != nil { return false, err } - status := daemonset.(*appsv1.DaemonSet).Status + status := daemonset.(*appsv1.DaemonSet).Status // nolint: errcheck if status.NumberReady == status.DesiredNumberScheduled && status.NumberUnavailable == 0 { done = true } diff --git a/klient/wait/wait_test.go b/klient/wait/wait_test.go index 5b073b6d..67d3485a 100644 --- a/klient/wait/wait_test.go +++ b/klient/wait/wait_test.go @@ -113,7 +113,7 @@ func TestResourceScaled(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() err = wait.For(conditions.New(getResourceManager()).ResourceScaled(deployment, func(object k8s.Object) int32 { - return object.(*appsv1.Deployment).Status.ReadyReplicas + return object.(*appsv1.Deployment).Status.ReadyReplicas // nolint: errcheck }, 2), wait.WithContext(ctx)) if err != nil { t.Error("failed waiting for resource to be scaled", err) @@ -147,7 +147,7 @@ func TestResourceListMatchN(t *testing.T) { createDeployment("d4", 5, t) pods := &v1.PodList{} err = wait.For(conditions.New(getResourceManager()).ResourceListMatchN(pods, 5, func(object k8s.Object) bool { - for _, c := range object.(*v1.Pod).Spec.Containers { + for _, c := range object.(*v1.Pod).Spec.Containers { // nolint: errcheck if c.Image == "nginx" { return true } @@ -175,7 +175,7 @@ func TestResourcesMatch(t *testing.T) { }, } err = wait.For(conditions.New(getResourceManager()).ResourcesMatch(pods, func(object k8s.Object) bool { - return object.(*v1.Pod).Status.Phase == v1.PodRunning + return object.(*v1.Pod).Status.Phase == v1.PodRunning // nolint: errcheck })) if err != nil { t.Error("failed waiting for deployment pods to start running", err) diff --git a/pkg/env/action_test.go b/pkg/env/action_test.go index 80f1a962..5733441c 100644 --- a/pkg/env/action_test.go +++ b/pkg/env/action_test.go @@ -76,7 +76,7 @@ func TestAction_Run(t *testing.T) { setup: func(ctx context.Context, cfg *envconf.Config) (val int, err error) { funcs := []types.EnvFunc{ func(ctx context.Context, cfg *envconf.Config) (context.Context, error) { - i := ctx.Value(&ctxTestKeyString{}).(int) + 2 + i := ctx.Value(&ctxTestKeyString{}).(int) + 2 // nolint: errcheck val = i return ctx, nil }, diff --git a/pkg/env/env_test.go b/pkg/env/env_test.go index d1be7be0..7bba84fb 100644 --- a/pkg/env/env_test.go +++ b/pkg/env/env_test.go @@ -317,7 +317,7 @@ func TestEnv_Test(t *testing.T) { }) out := env.Test(t, f.Feature()) - return out.Value(&ctxTestKeyString{}).([]string) + return out.Value(&ctxTestKeyString{}).([]string) // nolint: errcheck }, }, { @@ -392,7 +392,7 @@ func TestEnv_Test(t *testing.T) { }).Feature() out := env.Test(t, f1, f2) - return out.Value(&ctxTestKeyString{}).([]string) + return out.Value(&ctxTestKeyString{}).([]string) // nolint: errcheck }, }, { @@ -442,7 +442,7 @@ func TestEnv_Test(t *testing.T) { }).Feature() out := env.TestInParallel(t, f1, f2) - return out.Value(&ctxTestKeyString{}).([]string) + return out.Value(&ctxTestKeyString{}).([]string) // nolint: errcheck }, }, { @@ -928,7 +928,7 @@ func getFeaturesForTest() []features.Feature { Assess("log a message", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { t.Log("Running in parallel 1 1") if i := ctx.Value(ctxRunsKeyString{}); i != nil { - return context.WithValue(ctx, ctxRunsKeyString{}, i.(int)+1) + return context.WithValue(ctx, ctxRunsKeyString{}, i.(int)+1) // nolint: errcheck } return context.WithValue(ctx, ctxRunsKeyString{}, 1) }).Feature() @@ -936,7 +936,7 @@ func getFeaturesForTest() []features.Feature { Assess("log a message", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { t.Log("Running in parallel 1 2") if i := ctx.Value(ctxRunsKeyString{}); i != nil { - return context.WithValue(ctx, ctxRunsKeyString{}, i.(int)+1) + return context.WithValue(ctx, ctxRunsKeyString{}, i.(int)+1) // nolint: errcheck } return context.WithValue(ctx, ctxRunsKeyString{}, 1) }).Feature() diff --git a/pkg/envfuncs/kind_funcs.go b/pkg/envfuncs/kind_funcs.go index 66f621bb..046012c1 100644 --- a/pkg/envfuncs/kind_funcs.go +++ b/pkg/envfuncs/kind_funcs.go @@ -27,7 +27,7 @@ import ( func GetKindClusterFromContext(ctx context.Context, clusterName string) (*kind.Cluster, bool) { provider, ok := GetClusterFromContext(ctx, clusterName) if ok { - return provider.(*kind.Cluster), ok + return provider.(*kind.Cluster), ok // nolint: errcheck } return nil, ok }