Skip to content

Commit 60d26ed

Browse files
perdasilvaPer Goncalves da Silva
and
Per Goncalves da Silva
authored
🌱 lint update (#1036)
* update golangci-lint version Signed-off-by: Per Goncalves da Silva <[email protected]> * update golangci-lint configuration Signed-off-by: Per Goncalves da Silva <[email protected]> * update make fmt target Signed-off-by: Per Goncalves da Silva <[email protected]> * fix lint issues Signed-off-by: Per Goncalves da Silva <[email protected]> --------- Signed-off-by: Per Goncalves da Silva <[email protected]> Co-authored-by: Per Goncalves da Silva <[email protected]>
1 parent 1d1c322 commit 60d26ed

File tree

7 files changed

+115
-12
lines changed

7 files changed

+115
-12
lines changed

.bingo/Variables.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ $(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod
2929
@echo "(re)installing $(GOBIN)/controller-gen-v0.15.0"
3030
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=controller-gen.mod -o=$(GOBIN)/controller-gen-v0.15.0 "sigs.k8s.io/controller-tools/cmd/controller-gen"
3131

32-
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.57.2
32+
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.1
3333
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
3434
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
35-
@echo "(re)installing $(GOBIN)/golangci-lint-v1.57.2"
36-
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.57.2 "github.com/golangci/golangci-lint/cmd/golangci-lint"
35+
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.1"
36+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.59.1 "github.com/golangci/golangci-lint/cmd/golangci-lint"
3737

3838
GORELEASER := $(GOBIN)/goreleaser-v1.16.2
3939
$(GORELEASER): $(BINGO_DIR)/goreleaser.mod

.bingo/golangci-lint.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ go 1.21
44

55
toolchain go1.22.2
66

7-
require github.com/golangci/golangci-lint v1.57.2 // cmd/golangci-lint
7+
require github.com/golangci/golangci-lint v1.59.1 // cmd/golangci-lint

.bingo/golangci-lint.sum

+106
Large diffs are not rendered by default.

.bingo/variables.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ BINGO="${GOBIN}/bingo-v0.8.0"
1212

1313
CONTROLLER_GEN="${GOBIN}/controller-gen-v0.15.0"
1414

15-
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.57.2"
15+
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.59.1"
1616

1717
GORELEASER="${GOBIN}/goreleaser-v1.16.2"
1818

.golangci.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ linters-settings:
4343
- dot
4444
- default
4545
- prefix(github.com/operator-framework)
46-
47-
# TODO: change this to `localmodule` when golangci-lint
48-
# is updated to 1.58+
49-
- prefix(github.com/operator-framework/operator-controller)
46+
- localmodule
5047
custom-order: true
5148

5249
errorlint:

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ verify: tidy fmt vet generate manifests #HELP Verify all generated code is up-to
106106
git diff --exit-code
107107

108108
.PHONY: fmt
109-
fmt: #EXHELP Run go fmt against code.
110-
go fmt ./...
109+
fmt: $(GOLANGCI_LINT) #EXHELP Formats code
110+
go fmt ./... && $(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_ARGS)
111111

112112
.PHONY: vet
113113
vet: #EXHELP Run go vet against code.

internal/catalogmetadata/cache/cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *c
141141
if err := os.MkdirAll(filepath.Dir(metaPath), os.ModePerm); err != nil {
142142
return fmt.Errorf("error creating directory for catalog metadata: %v", err)
143143
}
144-
if err := os.WriteFile(metaPath, meta.Blob, os.ModePerm); err != nil {
144+
if err := os.WriteFile(metaPath, meta.Blob, 0600); err != nil {
145145
return fmt.Errorf("error writing catalog metadata to file: %v", err)
146146
}
147147
return nil

0 commit comments

Comments
 (0)