Skip to content

Commit aa6d15e

Browse files
authored
fix(bff): port to golangci-lint v2 (#948)
* fix(bff): port to golangci-lint v2 Signed-off-by: Alessio Pragliola <seth.pro@gmail.com> * fix(gha): bump golanglint-ci version in action Signed-off-by: Alessio Pragliola <seth.pro@gmail.com> --------- Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
1 parent 6fb1abc commit aa6d15e

4 files changed

Lines changed: 32 additions & 13 deletions

File tree

.github/workflows/ui-bff-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Lint
3636
uses: golangci/golangci-lint-action@v7
3737
with:
38-
version: v1.63.4
38+
version: v2.0.2
3939
working-directory: clients/ui/bff/
4040

4141
- name: Build

clients/ui/bff/.golangci.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
1-
run:
2-
timeout: 3m
1+
version: "2"
2+
linters:
3+
exclusions:
4+
generated: lax
5+
presets:
6+
- comments
7+
- common-false-positives
8+
- legacy
9+
- std-error-handling
10+
paths:
11+
- third_party$
12+
- builtin$
13+
- examples$
14+
formatters:
15+
exclusions:
16+
generated: lax
17+
paths:
18+
- third_party$
19+
- builtin$
20+
- examples$

clients/ui/bff/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
6464
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
6565

6666
## Tool Versions
67-
GOLANGCI_LINT_VERSION ?= v1.63.4
67+
GOLANGCI_LINT_VERSION ?= v2.0.2
6868
ENVTEST_VERSION ?= release-0.17
6969

7070
.PHONY: envtest
@@ -75,7 +75,7 @@ $(ENVTEST): $(LOCALBIN)
7575
.PHONY: golangci-lint
7676
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
7777
$(GOLANGCI_LINT): $(LOCALBIN)
78-
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
78+
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,${GOLANGCI_LINT_VERSION})
7979

8080

8181
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist

clients/ui/bff/internal/integrations/http.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import (
44
"crypto/tls"
55
"encoding/json"
66
"fmt"
7-
"github.com/google/uuid"
8-
helper "github.com/kubeflow/model-registry/ui/bff/internal/helpers"
97
"io"
108
"log/slog"
119
"net/http"
1210
"strconv"
11+
12+
"github.com/google/uuid"
13+
helper "github.com/kubeflow/model-registry/ui/bff/internal/helpers"
1314
)
1415

1516
type HTTPClientInterface interface {
@@ -90,8 +91,8 @@ func (c *HTTPClient) GET(url string) ([]byte, error) {
9091
//Sometimes the code comes empty from model registry API
9192
//also not all error codes are correctly implemented
9293
//see https://github.com/kubeflow/model-registry/issues/95
93-
if httpError.ErrorResponse.Code == "" {
94-
httpError.ErrorResponse.Code = strconv.Itoa(response.StatusCode)
94+
if httpError.Code == "" {
95+
httpError.Code = strconv.Itoa(response.StatusCode)
9596
}
9697
return nil, httpError
9798
}
@@ -136,8 +137,8 @@ func (c *HTTPClient) POST(url string, body io.Reader) ([]byte, error) {
136137
//Sometimes the code comes empty from model registry API
137138
//also not all error codes are correctly implemented
138139
//see https://github.com/kubeflow/model-registry/issues/95
139-
if httpError.ErrorResponse.Code == "" {
140-
httpError.ErrorResponse.Code = strconv.Itoa(response.StatusCode)
140+
if httpError.Code == "" {
141+
httpError.Code = strconv.Itoa(response.StatusCode)
141142
}
142143
return nil, httpError
143144
}
@@ -182,8 +183,8 @@ func (c *HTTPClient) PATCH(url string, body io.Reader) ([]byte, error) {
182183
//Sometimes the code comes empty from model registry API
183184
//also not all error codes are correctly implemented
184185
//see https://github.com/kubeflow/model-registry/issues/95
185-
if httpError.ErrorResponse.Code == "" {
186-
httpError.ErrorResponse.Code = strconv.Itoa(response.StatusCode)
186+
if httpError.Code == "" {
187+
httpError.Code = strconv.Itoa(response.StatusCode)
187188
}
188189
return nil, httpError
189190
}

0 commit comments

Comments
 (0)