Skip to content

Commit c98fd21

Browse files
authored
Merge pull request #217 from tariq1890/add-golangci-lint
update golang and controller-tools versions, use golangci-lint
2 parents d0f42cc + 427c40a commit c98fd21

File tree

4 files changed

+44
-16
lines changed

4 files changed

+44
-16
lines changed

.github/workflows/build.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,20 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99

10-
- name: Set up Go 1.21
10+
- name: Set up Go 1.23
1111
uses: actions/setup-go@v4
1212
with:
13-
go-version: "1.21"
13+
go-version: "1.23"
1414

1515
- uses: actions/checkout@v3
1616

17+
- name: Set up golangci-lint
18+
uses: golangci/golangci-lint-action@v6
19+
with:
20+
version: v1.60.3
21+
args: -v --timeout 5m
22+
skip-cache: true
23+
1724
- name: Run go generate
1825
run: |
1926
set -x
@@ -22,15 +29,13 @@ jobs:
2229
git diff | cat
2330
git status --porcelain=v1
2431
test $(git status --porcelain=v1 | wc -l) -eq 0
25-
env:
26-
GO111MODULE: on
2732
2833
build:
2934
name: Run tests
3035
runs-on: ubuntu-latest
3136
strategy:
3237
matrix:
33-
go: [ '1.21' ]
38+
go: [ '1.23' ]
3439

3540
steps:
3641
- uses: actions/checkout@v3
@@ -40,5 +45,12 @@ jobs:
4045
with:
4146
go-version: ${{ matrix.go }}
4247

48+
- name: Set up golangci-lint
49+
uses: golangci/golangci-lint-action@v6
50+
with:
51+
version: v1.60.3
52+
args: -v --timeout 5m
53+
skip-cache: true
54+
4355
- name: Run unit tests
4456
run: make test

.golangci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
run:
2+
timeout: 10m
3+
4+
linters:
5+
enable:
6+
- contextcheck
7+
- gocritic
8+
- gofmt
9+
- goimports
10+
- gosec
11+
- gosimple
12+
- govet
13+
- ineffassign
14+
- misspell
15+
- staticcheck
16+
- unconvert
17+
18+
linters-settings:
19+
goimports:
20+
local-prefixes: github.com/mittwald/go-helm-client

Makefile

+6-10
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,18 @@ help: ## Display this help.
1919
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
2020

2121

22-
.PHONY: fmt
23-
fmt: ## Run go fmt against code.
24-
go fmt ./...
25-
26-
.PHONY: vet
27-
vet: ## Run go vet against code.
28-
go vet ./...
22+
.PHONY: lint
23+
lint: ## Run golangci-lint against code.
24+
golangci-lint run ./...
2925

3026
##@ Build
3127

3228
.PHONY: build
33-
build: generate fmt vet ## Build binary.
29+
build: generate lint ## Build binary.
3430
go build -o bin/client .
3531

3632
.PHONY: test
37-
test: generate fmt vet ## Run tests.
33+
test: generate lint ## Run tests.
3834
go test ./... -coverprofile cover.out
3935

4036
.PHONY: generate
@@ -55,7 +51,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
5551

5652
## Tool Versions
5753
MOCKGEN_VERSION ?= v0.4.0
58-
CONTROLLER_TOOLS_VERSION ?= v0.13.0
54+
CONTROLLER_TOOLS_VERSION ?= v0.16.1
5955

6056
.PHONY: mockgen
6157
mockgen: $(MOCKGEN) ## Download mockgen locally if necessary.

client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ func (c *HelmClient) RunChartTests(releaseName string) (bool, error) {
793793
}
794794

795795
// Check that there are no test failures
796-
return checkReleaseForTestFailure(rel) == false, nil
796+
return !checkReleaseForTestFailure(rel), nil
797797
}
798798

799799
// chartExists checks whether a chart is already installed

0 commit comments

Comments
 (0)