Skip to content

Commit 3a5f042

Browse files
Add govulncheck to pipeline, update golangci-linter (#1302)
* Add govulncheck to pipeline, update golangci-linter Two linter warnings fixed to pass the build * Add to Travis * Do not fail build on 1.19 * Remove vulncheck from travisCI --------- Co-authored-by: Adam Janikowski <12255597+ajanikow@users.noreply.github.com>
1 parent b8ef2de commit 3a5f042

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
4+
- (Maintenance) Add govulncheck to pipeline, update golangci-linter
45

56
## [1.2.28](https://github.com/arangodb/kube-arangodb/tree/1.2.28) (2023-06-05)
67
- (Feature) ArangoBackup create retries and MaxIterations limit

Makefile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ PROTOSOURCES := $(shell find ./ -type f -name '*.proto' $(foreach EXCLUDE_DIR,$
224224
all: check-vars verify-generated build
225225

226226
.PHONY: compile
227-
compile: check-vars build
227+
compile: check-vars build
228228

229229
# allall is now obsolete
230230
.PHONY: allall
@@ -277,6 +277,11 @@ linter:
277277
linter-fix:
278278
@$(GOPATH)/bin/golangci-lint run --fix --build-tags "$(RELEASE_MODE)" $(foreach LINT_EXCLUDE,$(LINT_EXCLUDES),--exclude '$(LINT_EXCLUDE)') ./...
279279

280+
.PHONY: vulncheck
281+
vulncheck:
282+
@echo ">> Checking for known vulnerabilities"
283+
@$(GOPATH)/bin/govulncheck --tags $(RELEASE_MODE) ./...
284+
280285
.PHONY: build
281286
build: docker manifests
282287

@@ -533,7 +538,7 @@ init: vendor tools update-generated $(BIN)
533538
.PHONY: tools-min
534539
tools-min: update-vendor
535540
@echo ">> Fetching golangci-lint linter"
536-
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1
541+
@GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2
537542
@echo ">> Fetching goimports"
538543
@GOBIN=$(GOPATH)/bin go install golang.org/x/tools/cmd/goimports@0bb7e5c47b1a31f85d4f173edc878a8e049764a5
539544
@echo ">> Fetching license check"
@@ -555,6 +560,8 @@ tools: tools-min
555560
@echo ">> Fetching protoc go plugins..."
556561
@GOBIN=$(GOPATH)/bin go install github.com/golang/protobuf/protoc-gen-go@v1.5.2
557562
@GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
563+
@echo ">> Fetching govulncheck"
564+
@GOBIN=$(GOPATH)/bin go install golang.org/x/vuln/cmd/govulncheck@v0.1.0
558565

559566
.PHONY: vendor
560567
vendor:
@@ -635,7 +642,7 @@ check-community:
635642
@$(MAKE) _check RELEASE_MODE=community
636643

637644
_check: sync-crds
638-
@$(MAKE) fmt yamlfmt license-verify linter run-unit-tests bin
645+
@$(MAKE) fmt yamlfmt license-verify linter run-unit-tests bin vulncheck
639646

640647
generate: generate-internal generate-proto fmt
641648

pkg/deployment/resources/env_builder.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
2+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ func (e *EnvBuilder) Add(override bool, envs ...core.EnvVar) (modified bool) {
3434
if id, ok := e.getID(env); ok {
3535
if override {
3636
(*e)[id] = env
37-
modified = true
3837
}
3938
}
4039

pkg/deployment/resources/inspector/sm.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -102,16 +102,12 @@ func (p serviceMonitorsInspectorLoader) getV1ServiceMonitorsList(ctx context.Con
102102
ptrs := make([]*monitoring.ServiceMonitor, 0, s)
103103

104104
for {
105-
for id := range items {
106-
ptrs = append(ptrs, items[id])
107-
}
108-
105+
ptrs = append(ptrs, items...)
109106
if cont == "" {
110107
break
111108
}
112109

113110
items, cont, err = p.getV1ServiceMonitorsListRequest(ctx, i, cont)
114-
115111
if err != nil {
116112
return nil, err
117113
}

0 commit comments

Comments
 (0)