Skip to content

Commit

Permalink
golangci-lint: Bump to latest to fix high memory consumption
Browse files Browse the repository at this point in the history
- Update deprecated fields in `.golangci.yaml`.
- Remove deprecated `--deadline` flag.
- Replace deprecated `k8s.io/utils/pointer` with new generic `k8s.io/utils/ptr` package.
  • Loading branch information
alebedev87 committed Aug 14, 2024
1 parent 67ec0f2 commit e9c00b9
Show file tree
Hide file tree
Showing 9 changed files with 292 additions and 290 deletions.
8 changes: 5 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ run:
# from this option's value (see skip-dirs-use-default).
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
skip-dirs:
- vendor
issues:
exclude-dirs:
- vendor

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
Expand All @@ -50,7 +51,8 @@ run:
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
# default is "colored-line-number"
format: tab
formats:
- format: tab

# print lines of code with issue, default is true
print-issued-lines: true
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ endef
.PHONY: lint
## Checks the code with golangci-lint
lint: $(GOLANGCI_LINT_BIN)
$(GOLANGCI_LINT_BIN) run -c .golangci.yaml --deadline=30m
$(GOLANGCI_LINT_BIN) run -c .golangci.yaml

$(GOLANGCI_LINT_BIN):
mkdir -p $(BIN_DIR)
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta1/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)

func makeExternalDNS(name string, domains []ExternalDNSDomain) *ExternalDNS {
Expand Down Expand Up @@ -139,7 +139,7 @@ var _ = Describe("ExternalDNS admission webhook", func() {
{
ExternalDNSDomainUnion: ExternalDNSDomainUnion{
MatchType: DomainMatchTypeRegex,
Pattern: pointer.String(`(.*\.test.com`),
Pattern: ptr.To[string](`(.*\.test.com`),
},
FilterType: FilterTypeInclude,
},
Expand All @@ -166,14 +166,14 @@ var _ = Describe("ExternalDNS admission webhook", func() {
{
ExternalDNSDomainUnion: ExternalDNSDomainUnion{
MatchType: DomainMatchTypeExact,
Name: pointer.String("abc.test.com"),
Name: ptr.To[string]("abc.test.com"),
},
FilterType: FilterTypeInclude,
},
{
ExternalDNSDomainUnion: ExternalDNSDomainUnion{
MatchType: DomainMatchTypeExact,
Name: pointer.String(`(.*)\.test\.com`),
Name: ptr.To[string](`(.*)\.test\.com`),
},
FilterType: FilterTypeInclude,
},
Expand Down
6 changes: 3 additions & 3 deletions hack/golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
set -e

GOLANGCI_VERSION="1.51.2"
GOLANGCI_VERSION="1.59.1"

OUTPUT_PATH=${1:-./bin/golangci-lint}

Expand All @@ -10,10 +10,10 @@ GOARCH=$(go env GOARCH)

case $GOOS in
linux)
CHECKSUM="4de479eb9d9bc29da51aec1834e7c255b333723d38dbd56781c68e5dddc6a90b"
CHECKSUM="c30696f1292cff8778a495400745f0f9c0406a3f38d8bb12cef48d599f6c7791"
;;
darwin)
CHECKSUM="0549cbaa2df451cf3a2011a9d73a9cb127784d26749d9cd14c9f4818af104d44"
CHECKSUM="2f945063394a489c0037f0369c0ce21bc007565c08f90b924a35f4c04721cbc0"
;;
*)
echo "Unsupported OS $GOOS"
Expand Down
Loading

0 comments on commit e9c00b9

Please sign in to comment.