Skip to content

Commit 5c6551d

Browse files
Florian SandelFlorian Sandel
Florian Sandel
authored and
Florian Sandel
committed
bump go version and fix linter
1 parent 4349d89 commit 5c6551d

12 files changed

+43
-93
lines changed

.golangci.yaml

+14-74
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,21 @@ run:
1515
build-tags:
1616
- mytag
1717

18-
# which dirs to skip: issues from them won't be reported;
19-
# can use regexp here: generated.*, regexp is applied on full path;
20-
# default value is empty list, but default dirs are skipped independently
21-
# from this option's value (see skip-dirs-use-default).
22-
# "/" will be replaced by current OS file path separator to properly work
23-
# on Windows.
24-
skip-dirs:
25-
- "./include/*"
26-
27-
# default is true. Enables skipping of directories:
28-
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
29-
skip-dirs-use-default: true
30-
31-
# which files to skip: they will be analyzed, but issues from them
32-
# won't be reported. Default value is empty list, but there is
33-
# no need to include all autogenerated files, we confidently recognize
34-
# autogenerated files. If it's not please let us know.
35-
# "/" will be replaced by current OS file path separator to properly work
36-
# on Windows.
37-
skip-files:
38-
- ".*\\.my\\.go$"
39-
- lib/bad.go
40-
4118
# Allow multiple parallel golangci-lint instances running.
4219
# If false (default) - golangci-lint acquires file lock on start.
4320
allow-parallel-runners: false
4421

22+
go: "1.23.5"
23+
4524

4625
# output configuration options
4726
output:
48-
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
49-
# default is "colored-line-number"
50-
format: colored-line-number
51-
5227
# print lines of code with issue, default is true
5328
print-issued-lines: true
5429

5530
# print linter name in the end of issue text, default is true
5631
print-linter-name: true
5732

58-
# make issues output unique by line, default is true
59-
uniq-by-line: true
60-
6133
# add a prefix to the output file references; default is no prefix
6234
path-prefix: ""
6335

@@ -147,10 +119,13 @@ linters-settings:
147119
statements: 40
148120

149121
gci:
150-
# put imports beginning with prefix after 3rd-party packages;
151-
# only support one prefix
152-
# if not set, use goimports.local-prefixes
153-
local-prefixes: github.com/org/project
122+
sections:
123+
- standard
124+
- default
125+
- prefix(github.com/stackitcloud/external-dns-stackit-webhook)
126+
127+
goimports:
128+
local-prefixes: github.com/stackitcloud/external-dns-stackit-webhook
154129

155130
gocognit:
156131
# minimal code complexity to report, 30 by default (but we recommend 10-20)
@@ -268,13 +243,6 @@ linters-settings:
268243
# simplify code: gofmt with `-s` option, true by default
269244
simplify: true
270245

271-
gofumpt:
272-
# Select the Go version to target. The default is `1.15`.
273-
lang-version: "1.15"
274-
275-
# Choose whether or not to use the extra rules that are disabled
276-
# by default
277-
extra-rules: false
278246

279247
goheader:
280248
values:
@@ -305,11 +273,6 @@ linters-settings:
305273
template-path:
306274
# also as alternative of directive 'template' you may put the path to file with the template source
307275

308-
goimports:
309-
# put imports beginning with prefix after 3rd-party packages;
310-
# it's a comma-separated list of prefixes
311-
local-prefixes: github.com/org/project
312-
313276
golint:
314277
# minimal confidence for issues, default is 0.8
315278
min-confidence: 0.8
@@ -383,15 +346,10 @@ linters-settings:
383346
truncate: "32"
384347

385348
gosimple:
386-
# Select the Go version to target. The default is '1.13'.
387-
go: "1.15"
388349
# https://staticcheck.io/docs/options#checks
389350
checks: [ "all" ]
390351

391352
govet:
392-
# report about shadowed variables
393-
check-shadowing: true
394-
395353
# settings per analyzer
396354
settings:
397355
printf: # analyzer name, run `go tool vet help` to see all analyzers
@@ -405,9 +363,9 @@ linters-settings:
405363
# run `go tool vet help` to see all analyzers
406364
enable:
407365
- atomicalign
408-
enable-all: false
409-
disable:
410366
- shadow
367+
368+
enable-all: false
411369
disable-all: false
412370

413371
depguard:
@@ -551,14 +509,10 @@ linters-settings:
551509
allowFloats: "0.0,0.,1.0,1.,2.0,2."
552510

553511
staticcheck:
554-
# Select the Go version to target. The default is '1.13'.
555-
go: "1.15"
556512
# https://staticcheck.io/docs/options#checks
557513
checks: [ "all" ]
558514

559515
stylecheck:
560-
# Select the Go version to target. The default is '1.13'.
561-
go: "1.15"
562516
# https://staticcheck.io/docs/options#checks
563517
checks: [ "all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022" ]
564518
# https://staticcheck.io/docs/options#dot_import_whitelist
@@ -600,11 +554,6 @@ linters-settings:
600554
name: true
601555
begin: true
602556

603-
tenv:
604-
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
605-
# By default, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
606-
all: false
607-
608557
unparam:
609558
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
610559
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
@@ -613,8 +562,6 @@ linters-settings:
613562
check-exported: false
614563

615564
unused:
616-
# Select the Go version to target. The default is '1.13'.
617-
go: "1.15"
618565

619566
varnamelen:
620567
# The longest distance, in source lines, that is being considered a "small scope." (defaults to 5)
@@ -674,7 +621,6 @@ linters:
674621
- errname
675622
- errorlint
676623
- exhaustive
677-
- exportloopref
678624
- forcetypeassert
679625
- funlen
680626
- gci
@@ -685,7 +631,6 @@ linters:
685631
- godot
686632
- godox
687633
- gofmt
688-
- gofumpt
689634
- goheader
690635
- gomoddirectives
691636
- gomodguard
@@ -708,12 +653,12 @@ linters:
708653
- predeclared
709654
- promlinter
710655
- staticcheck
711-
- tenv
712656
- thelper
713657
- tparallel
714658
- unconvert
715659
- unparam
716660
- unused
661+
- usetesting
717662
- whitespace
718663
- paralleltest
719664
enable-all: false
@@ -726,14 +671,11 @@ linters:
726671
- goimports
727672
- lll
728673
- stylecheck
729-
- gomnd
730674
- testpackage
731675
- wrapcheck
732-
- golint
733-
- scopelint
734676
- typecheck
735677
- tagliatelle
736-
- goerr113
678+
- err113
737679
- gochecknoglobals
738680
- wsl
739681
- revive
@@ -819,12 +761,10 @@ issues:
819761
# Default is false.
820762
new: false
821763

822-
# Show only new issues created after git revision `REV`
823-
new-from-rev: REV
824-
825764
# Fix found issues (if it's supported by the linter)
826765
fix: true
827766

767+
828768
severity:
829769
# Default value is empty string.
830770
# Set the default severity for issues. If severity rules are defined and the issues

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GOLANGCI_VERSION = 1.59.1
1+
GOLANGCI_VERSION = 1.64.8
22
LICENCES_IGNORE_LIST = $(shell cat licenses/licenses-ignore-list.txt)
33

44
VERSION ?= 0.0.1

cmd/webhook/cmd/root.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import (
88
"github.com/spf13/cobra"
99
"github.com/spf13/pflag"
1010
"github.com/spf13/viper"
11+
"go.uber.org/zap"
12+
"go.uber.org/zap/zapcore"
13+
"sigs.k8s.io/external-dns/endpoint"
14+
1115
"github.com/stackitcloud/external-dns-stackit-webhook/internal/stackitprovider"
1216
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
1317
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics"
1418
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/stackit"
15-
"go.uber.org/zap"
16-
"go.uber.org/zap/zapcore"
17-
"sigs.k8s.io/external-dns/endpoint"
1819
)
1920

2021
var (

pkg/api/adjust_endpoints_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88

99
"github.com/goccy/go-json"
1010
"github.com/gofiber/fiber/v2"
11-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
12-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1311
"github.com/stretchr/testify/assert"
1412
"go.uber.org/mock/gomock"
1513
"go.uber.org/zap"
1614
"sigs.k8s.io/external-dns/endpoint"
15+
16+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
17+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1718
)
1819

1920
func TestWebhook_AdjustEndpoints(t *testing.T) {

pkg/api/api.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import (
1515
fiberlogger "github.com/gofiber/fiber/v2/middleware/logger"
1616
"github.com/gofiber/fiber/v2/middleware/pprof"
1717
fiberrecover "github.com/gofiber/fiber/v2/middleware/recover"
18-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics"
1918
"go.uber.org/zap"
2019
"sigs.k8s.io/external-dns/provider"
20+
21+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics"
2122
)
2223

2324
type Api interface {

pkg/api/api_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
12-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1311
"github.com/stretchr/testify/assert"
1412
"go.uber.org/mock/gomock"
1513
"go.uber.org/zap"
14+
15+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
16+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1617
)
1718

1819
func TestApi(t *testing.T) {

pkg/api/apply_changes_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import (
99
"testing"
1010

1111
"github.com/gofiber/fiber/v2"
12-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
13-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1412
"github.com/stretchr/testify/assert"
1513
"go.uber.org/mock/gomock"
1614
"go.uber.org/zap"
1715
"sigs.k8s.io/external-dns/endpoint"
1816
"sigs.k8s.io/external-dns/plan"
17+
18+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
19+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1920
)
2021

2122
func TestWebhook_ApplyChanges(t *testing.T) {

pkg/api/domain_filter_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import (
88

99
"github.com/goccy/go-json"
1010
"github.com/gofiber/fiber/v2"
11-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
12-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1311
"github.com/stretchr/testify/assert"
1412
"go.uber.org/mock/gomock"
1513
"go.uber.org/zap"
1614
"sigs.k8s.io/external-dns/endpoint"
15+
16+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
17+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1718
)
1819

1920
func TestWebhook_DomainFilter(t *testing.T) {

pkg/api/health_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"testing"
77

88
"github.com/gofiber/fiber/v2"
9-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
10-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
119
"github.com/stretchr/testify/assert"
1210
"go.uber.org/mock/gomock"
1311
"go.uber.org/zap"
12+
13+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
14+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1415
)
1516

1617
func TestHealth(t *testing.T) {

pkg/api/metrics.go

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/gofiber/adaptor/v2"
88
"github.com/gofiber/fiber/v2"
99
"github.com/prometheus/client_golang/prometheus/promhttp"
10+
1011
metrics_collector "github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics"
1112
)
1213

pkg/api/metrics_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"testing"
77

88
"github.com/gofiber/fiber/v2"
9+
"github.com/stretchr/testify/assert"
10+
"go.uber.org/mock/gomock"
11+
912
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
1013
metrics_collector "github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics"
1114
mock_metrics_collector "github.com/stackitcloud/external-dns-stackit-webhook/pkg/metrics/mock"
12-
"github.com/stretchr/testify/assert"
13-
"go.uber.org/mock/gomock"
1415
)
1516

1617
func TestMetricsMiddleware(t *testing.T) {

pkg/api/records_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import (
77
"testing"
88

99
"github.com/goccy/go-json"
10-
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
11-
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1210
"github.com/stretchr/testify/assert"
1311
"go.uber.org/mock/gomock"
1412
"go.uber.org/zap"
1513
"sigs.k8s.io/external-dns/endpoint"
14+
15+
"github.com/stackitcloud/external-dns-stackit-webhook/pkg/api"
16+
mock_provider "github.com/stackitcloud/external-dns-stackit-webhook/pkg/api/mock"
1617
)
1718

1819
func TestWebhook_Records(t *testing.T) {

0 commit comments

Comments
 (0)