Skip to content

Commit d2db2d5

Browse files
aravindtgaefiacor
andauthored
Upgrade Go/kpt dependencies and disable govet inline analyzer (kptdev#1017)
* Upgrade Go/kpt dependencies and fix golangci-lint inline analyzer. Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech> * Address review comments. Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech> * Replace subpackage Upstream references to use the return type of latest sdk (github.com/kptdev/krm-functions-sdk/go/fn/kptfileapi) Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech> --------- Signed-off-by: Aravindhan Ayyanathan <aravindhan.a@est.tech> Co-authored-by: Fiachra Corcoran <fiachra.corcoran@est.tech>
1 parent c775b65 commit d2db2d5

15 files changed

Lines changed: 358 additions & 443 deletions

File tree

.golangci.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"text": "SA1019.*client\\.Apply"
4444
}
4545
]
46+
},
47+
"settings": {
48+
"govet": {
49+
"disable": ["inline"]
50+
}
4651
}
4752
},
4853
"run": {

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export PORCHDIR=$(abspath $(CURDIR))
1919

2020
# Base image versions
2121
export ALPINE_VERSION ?= 3.23.3
22-
export GOLANG_BOOKWORM_VERSION ?= 1.26.0-bookworm
23-
export GOLANG_ALPINE_VERSION ?= 1.26.0-alpine
22+
export GOLANG_BOOKWORM_VERSION ?= 1.26.3-bookworm
23+
export GOLANG_ALPINE_VERSION ?= 1.26.3-alpine
2424

2525
export DEPLOYPORCHCONFIGDIR ?= $(BUILDDIR)/deploy
2626
DEPLOYKPTCONFIGDIR=$(BUILDDIR)/kpt_pkgs
@@ -70,7 +70,7 @@ include make/infra.mk # docker-build, docker-push, help (+ container runt
7070
include make/go.mk # fmt, vet, lint, fix-headers, fix-all
7171
include make/testing.mk # test, unit, unit-clean, vulncheck, test-e2e*
7272
include make/security.mk # gosec, gosec-sarif
73-
include make/mocks.mk # install-mockery, generate-mocks, clean-mocks
73+
include make/mocks.mk # generate-mocks, clean-mocks
7474

7575
.DEFAULT_GOAL := help
7676

controllers/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ import (
2727
"strings"
2828
"time"
2929

30+
"golang.org/x/exp/slices"
31+
3032
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
3133
// to ensure that exec-entrypoint and run can make use of them.
3234
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
3335
"go.opentelemetry.io/otel"
34-
"golang.org/x/exp/slices"
36+
3537
_ "k8s.io/client-go/plugin/pkg/client/auth"
3638
"k8s.io/client-go/tools/leaderelection/resourcelock"
3739
"k8s.io/klog/v2"

controllers/packagerevisions/pkg/controllers/packagerevision/labels_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
// Copyright 2026 The kpt Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
package packagerevision
216

317
import (
@@ -156,7 +170,8 @@ func TestUpdateLatestRevisionLabels(t *testing.T) {
156170
}
157171
}
158172

159-
func TestUpdateLatestRevisionLabelsListError(t *testing.T) { mockClient := mockclient.NewMockClient(t)
173+
func TestUpdateLatestRevisionLabelsListError(t *testing.T) {
174+
mockClient := mockclient.NewMockClient(t)
160175
mockClient.EXPECT().List(mock.Anything, mock.AnythingOfType("*v1alpha2.PackageRevisionList"), mock.Anything, mock.Anything).
161176
Return(assert.AnError)
162177

controllers/packagerevisions/pkg/controllers/packagerevision/render_test.go

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"errors"
55
"testing"
66

7-
"github.com/stretchr/testify/assert"
87
porchv1alpha2 "github.com/kptdev/porch/api/porch/v1alpha2"
8+
"github.com/stretchr/testify/assert"
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
"sigs.k8s.io/controller-runtime/pkg/event"
1111
)
@@ -58,19 +58,19 @@ func TestRenderTrigger(t *testing.T) {
5858
wantAnno: false, wantSource: false,
5959
},
6060
{
61-
name: "annotation trigger — new annotation",
62-
pr: prWithRenderState("v1", "", "", "", ""),
63-
wantReq: "v1", wantAnno: true, wantSource: false,
61+
name: "annotation trigger — new annotation",
62+
pr: prWithRenderState("v1", "", "", "", ""),
63+
wantReq: "v1", wantAnno: true, wantSource: false,
6464
},
6565
{
66-
name: "annotation trigger — annotation differs from observed",
67-
pr: prWithRenderState("v2", "v1", "", "", metav1.ConditionTrue),
68-
wantReq: "v2", wantAnno: true, wantSource: false,
66+
name: "annotation trigger — annotation differs from observed",
67+
pr: prWithRenderState("v2", "v1", "", "", metav1.ConditionTrue),
68+
wantReq: "v2", wantAnno: true, wantSource: false,
6969
},
7070
{
71-
name: "no annotation trigger — annotation matches observed",
72-
pr: prWithRenderState("v1", "v1", "", "", metav1.ConditionTrue),
73-
wantReq: "v1", wantAnno: false, wantSource: false,
71+
name: "no annotation trigger — annotation matches observed",
72+
pr: prWithRenderState("v1", "v1", "", "", metav1.ConditionTrue),
73+
wantReq: "v1", wantAnno: false, wantSource: false,
7474
},
7575
{
7676
name: "source trigger — creationSource set, not rendered",
@@ -88,9 +88,9 @@ func TestRenderTrigger(t *testing.T) {
8888
wantAnno: false, wantSource: false,
8989
},
9090
{
91-
name: "both triggers",
92-
pr: prWithRenderState("v1", "", "", "init", metav1.ConditionUnknown),
93-
wantReq: "v1", wantAnno: true, wantSource: true,
91+
name: "both triggers",
92+
pr: prWithRenderState("v1", "", "", "init", metav1.ConditionUnknown),
93+
wantReq: "v1", wantAnno: true, wantSource: true,
9494
},
9595
{
9696
name: "source trigger on render failure",
@@ -109,7 +109,6 @@ func TestRenderTrigger(t *testing.T) {
109109
}
110110
}
111111

112-
113112
func TestIsRenderStale(t *testing.T) {
114113
assert.True(t, isRenderStale("v2", "v1"))
115114
assert.False(t, isRenderStale("v1", "v1"))
@@ -184,7 +183,6 @@ func TestRenderRequestChanged(t *testing.T) {
184183
}
185184
}
186185

187-
188186
func TestKptfileFromResources(t *testing.T) {
189187
tests := []struct {
190188
name string
@@ -244,7 +242,6 @@ info:
244242
}
245243
}
246244

247-
248245
func TestKptRendererSuccess(t *testing.T) {
249246
r := &kptRenderer{}
250247
resources := map[string]string{
@@ -280,7 +277,6 @@ func TestKptRendererNoKptfile(t *testing.T) {
280277
assert.Nil(t, result.results)
281278
}
282279

283-
284280
func TestMockRendererPipelineErr(t *testing.T) {
285281
m := &mockRenderer{
286282
resources: map[string]string{"Kptfile": "rendered"},

docs/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
baseURL = 'https://docs.porch.nephio.org/'
2-
languageCode = 'en-us'
2+
Locale = 'en-us'
33
title = 'Porch Documentation'
44

55
# based on https://www.docsy.dev/docs/get-started/docsy-as-module/start-from-scratch/

0 commit comments

Comments
 (0)