Skip to content

Commit 7d1c4bc

Browse files
Bump golangci/golangci-lint-action from 6 to 7 (#288)
* Bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * Bump golang-ci to `v2.0`, because `v1.*` is not supported by golangci-lint-action `v7.0` * Migrate `golangci-lint`'s configuration file to `v2` * Fix golint findings --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Damyan Yordanov <[email protected]>
1 parent 3ae32b4 commit 7d1c4bc

File tree

6 files changed

+38
-33
lines changed

6 files changed

+38
-33
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
with:
1616
go-version-file: 'go.mod'
1717
- name: golangci-lint
18-
uses: golangci/golangci-lint-action@v6
18+
uses: golangci/golangci-lint-action@v7
1919
with:
20-
version: v1.61
20+
version: v2.0

.golangci.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,47 @@
1+
version: "2"
12
run:
2-
timeout: 10m
33
allow-parallel-runners: true
4-
5-
issues:
6-
# don't skip warning about doc comments
7-
# don't exclude the default set of lint
8-
exclude-use-default: false
9-
# restore some of the defaults
10-
# (fill in the rest as needed)
11-
exclude-rules:
12-
- path: "plugins/*"
13-
linters:
14-
- dupl
15-
- lll
16-
- path: "internal/*"
17-
linters:
18-
- dupl
19-
- lll
204
linters:
21-
disable-all: true
5+
default: none
226
enable:
237
- copyloopvar
248
- dupl
259
- errcheck
10+
- ginkgolinter
2611
- goconst
2712
- gocyclo
28-
- gofmt
29-
- goimports
30-
- gosimple
3113
- govet
3214
- ineffassign
33-
- ginkgolinter
3415
- lll
3516
- misspell
3617
- nakedret
3718
- prealloc
3819
- staticcheck
39-
- typecheck
4020
- unconvert
4121
- unparam
4222
- unused
23+
exclusions:
24+
generated: lax
25+
rules:
26+
- linters:
27+
- dupl
28+
- lll
29+
path: plugins/*
30+
- linters:
31+
- dupl
32+
- lll
33+
path: internal/*
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$
38+
formatters:
39+
enable:
40+
- gofmt
41+
- goimports
42+
exclusions:
43+
generated: lax
44+
paths:
45+
- third_party$
46+
- builtin$
47+
- examples$

plugins/httpboot/plugin_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ func TestCustomHTTPBootRequestedKnownIP(t *testing.T) {
498498
time.Sleep(time.Second * 1)
499499

500500
ip := net.ParseIP(knownClientIP)
501-
err, relayedRequest := createHTTPBootRequest(t, ip)
501+
relayedRequest, err := createHTTPBootRequest(t, ip)
502502
if err != nil {
503503
t.Fatal(err)
504504
}
@@ -509,7 +509,7 @@ func TestCustomHTTPBootRequestedKnownIP(t *testing.T) {
509509

510510
func TestCustomHTTPBootRequestedKnownMAC(t *testing.T) {
511511
ip := net.ParseIP(notKnownClientIP)
512-
err, relayedRequest := createHTTPBootRequest(t, ip)
512+
relayedRequest, err := createHTTPBootRequest(t, ip)
513513
if err != nil {
514514
t.Fatal(err)
515515
}
@@ -520,7 +520,7 @@ func TestCustomHTTPBootRequestedKnownMAC(t *testing.T) {
520520

521521
func TestCustomHTTPBootRequestedUnknownClient(t *testing.T) {
522522
ip := net.ParseIP(notKnownClientIP)
523-
err, relayedRequest := createHTTPBootRequest(t, ip)
523+
relayedRequest, err := createHTTPBootRequest(t, ip)
524524
if err != nil {
525525
t.Fatal(err)
526526
}
@@ -529,7 +529,7 @@ func TestCustomHTTPBootRequestedUnknownClient(t *testing.T) {
529529
ensureBootURL(t, macAddress, relayedRequest, expectedDefaultCustomBootURL)
530530
}
531531

532-
func createHTTPBootRequest(t *testing.T, clientIP net.IP) (error, *dhcpv6.RelayMessage) {
532+
func createHTTPBootRequest(t *testing.T, clientIP net.IP) (*dhcpv6.RelayMessage, error) {
533533
tempDir := t.TempDir()
534534
_ = Init6(*customConfig, tempDir)
535535

@@ -552,7 +552,7 @@ func createHTTPBootRequest(t *testing.T, clientIP net.IP) (error, *dhcpv6.RelayM
552552
if err != nil {
553553
t.Fatal(err)
554554
}
555-
return err, relayedRequest
555+
return relayedRequest, err
556556
}
557557

558558
func ensureBootURL(t *testing.T, macAddress net.HardwareAddr, relayedRequest *dhcpv6.RelayMessage, expectedBootURL string) {

plugins/metal/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func GetIPAMIPAddressForMACAddress(mac net.HardwareAddr, subnetFamily ipamv1alph
338338
return nil, fmt.Errorf("failed to list IPs: %v", err)
339339
}
340340

341-
sanitizedMAC := strings.Replace(strings.ToLower(mac.String()), ":", "", -1)
341+
sanitizedMAC := strings.ReplaceAll(strings.ToLower(mac.String()), ":", "")
342342
for _, ip := range ips.Items {
343343
if ip.Labels["mac"] == sanitizedMAC && ipFamilyMatches(ip, subnetFamily) {
344344
return &ip.Status.Reserved.Net, nil

plugins/metal/plugin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var _ = Describe("Endpoint", func() {
3737
linkLocalIPV6Addr, err := eui64.ParseMAC(i, m)
3838
Expect(err).NotTo(HaveOccurred())
3939

40-
sanitizedMAC := strings.Replace(mac, ":", "", -1)
40+
sanitizedMAC := strings.ReplaceAll(mac, ":", "")
4141
ipv6Addr, err := ipamv1alpha1.IPAddrFromString(linkLocalIPV6Addr.String())
4242
Expect(err).NotTo(HaveOccurred())
4343
ipv6 := &ipamv1alpha1.IP{

plugins/oob/k8s.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func (k K8sClient) doCreateIpamIP(
250250
createdIpamIP := ipamIP.DeepCopy()
251251
err := k.Client.Get(k.Ctx, client.ObjectKeyFromObject(createdIpamIP), createdIpamIP)
252252
if err != nil && !apierrors.IsNotFound(err) {
253-
return nil, fmt.Errorf("Failed to get IP %s/%s: %w", createdIpamIP.Namespace, createdIpamIP.Name, err)
253+
return nil, fmt.Errorf("failed to get IP %s/%s: %w", createdIpamIP.Namespace, createdIpamIP.Name, err)
254254
}
255255
return createdIpamIP, nil
256256
}

0 commit comments

Comments
 (0)