Skip to content
This repository was archived by the owner on Jun 26, 2024. It is now read-only.

Commit 315b56f

Browse files
committed
WIP: Tweak golangci-lint to avoid out-of-memory in Github Actions
Signed-off-by: Pavel Macík <[email protected]>
1 parent 715859c commit 315b56f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

make/lint.mk

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ lint-yaml: ${YAML_FILES}
1111
$(Q)$(PYTHON_VENV_DIR)/bin/pip install yamllint==1.23.0
1212
$(Q)$(PYTHON_VENV_DIR)/bin/yamllint -c .yamllint $(YAML_FILES)
1313

14+
GO_LINT_CMD = $(Q)GOFLAGS="$(GOFLAGS)" GOGC=30 GOCACHE=$(GOCACHE) $(OUTPUT_DIR)/golangci-lint ${V_FLAG} run --concurrency=1 --verbose --deadline=30m --disable-all --enable
15+
1416
.PHONY: lint-go-code
1517
## Checks GO code
1618
lint-go-code: $(GOLANGCI_LINT_BIN) fmt vet
1719
# This is required for OpenShift CI enviroment
1820
# Ref: https://github.com/openshift/release/pull/3438#issuecomment-482053250
19-
$(Q)GOFLAGS="$(GOFLAGS)" GOCACHE="$(GOCACHE)" $(OUTPUT_DIR)/golangci-lint ${V_FLAG} run --deadline=30m
21+
$(GO_LINT_CMD) deadcode
22+
$(GO_LINT_CMD) errcheck
23+
$(GO_LINT_CMD) govet
24+
$(GO_LINT_CMD) ineffassign
25+
$(GO_LINT_CMD) staticcheck
26+
$(GO_LINT_CMD) structcheck
27+
$(GO_LINT_CMD) typecheck
28+
$(GO_LINT_CMD) unused
29+
$(GO_LINT_CMD) varcheck
30+
$(GO_LINT_CMD) gosimple
2031

2132
$(GOLANGCI_LINT_BIN):
22-
$(Q)curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./out v1.45.2
33+
$(Q)curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./out v1.48.0
2334

2435
.PHONY: lint-python-code
2536
## Check the python code

pkg/client/kubernetes/whoami.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package kubernetes
33
import (
44
"context"
55
"fmt"
6-
"io/ioutil"
76
authenticationapi "k8s.io/api/authentication/v1"
87
authorizationv1 "k8s.io/api/authorization/v1"
98
k8serrors "k8s.io/apimachinery/pkg/api/errors"
109
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1110
"k8s.io/client-go/kubernetes"
1211
"k8s.io/client-go/rest"
1312
"net/http"
13+
"os"
1414
"regexp"
1515
"strings"
1616
)
@@ -55,7 +55,7 @@ func WhoAmI(config *rest.Config) (string, error) {
5555
// from vendor/k8s.io/client-go/transport/round_trippers.go:HTTPWrappersForConfig function, tokenauth has preference over basicauth
5656
if transportConfig.HasTokenAuth() {
5757
if config.BearerTokenFile != "" {
58-
d, err := ioutil.ReadFile(config.BearerTokenFile)
58+
d, err := os.ReadFile(config.BearerTokenFile)
5959
if err != nil {
6060
return "", err
6161
}

0 commit comments

Comments
 (0)