Skip to content

Commit

Permalink
🌱 lint update (#1036)
Browse files Browse the repository at this point in the history
* update golangci-lint version

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

* update golangci-lint configuration

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

* update make fmt target

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

* fix lint issues

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>

---------

Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Co-authored-by: Per Goncalves da Silva <pegoncal@redhat.com>
  • Loading branch information
perdasilva and Per Goncalves da Silva committed Jul 12, 2024
1 parent 1d1c322 commit 60d26ed
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ $(CONTROLLER_GEN): $(BINGO_DIR)/controller-gen.mod
@echo "(re)installing $(GOBIN)/controller-gen-v0.15.0"
@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"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.57.2
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.59.1
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/golangci-lint-v1.57.2"
@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"
@echo "(re)installing $(GOBIN)/golangci-lint-v1.59.1"
@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"

GORELEASER := $(GOBIN)/goreleaser-v1.16.2
$(GORELEASER): $(BINGO_DIR)/goreleaser.mod
Expand Down
2 changes: 1 addition & 1 deletion .bingo/golangci-lint.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ go 1.21

toolchain go1.22.2

require github.com/golangci/golangci-lint v1.57.2 // cmd/golangci-lint
require github.com/golangci/golangci-lint v1.59.1 // cmd/golangci-lint
106 changes: 106 additions & 0 deletions .bingo/golangci-lint.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ BINGO="${GOBIN}/bingo-v0.8.0"

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

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

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

Expand Down
5 changes: 1 addition & 4 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ linters-settings:
- dot
- default
- prefix(github.com/operator-framework)

# TODO: change this to `localmodule` when golangci-lint
# is updated to 1.58+
- prefix(github.com/operator-framework/operator-controller)
- localmodule
custom-order: true

errorlint:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ verify: tidy fmt vet generate manifests #HELP Verify all generated code is up-to
git diff --exit-code

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

.PHONY: vet
vet: #EXHELP Run go vet against code.
Expand Down
2 changes: 1 addition & 1 deletion internal/catalogmetadata/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (fsc *filesystemCache) FetchCatalogContents(ctx context.Context, catalog *c
if err := os.MkdirAll(filepath.Dir(metaPath), os.ModePerm); err != nil {
return fmt.Errorf("error creating directory for catalog metadata: %v", err)
}
if err := os.WriteFile(metaPath, meta.Blob, os.ModePerm); err != nil {
if err := os.WriteFile(metaPath, meta.Blob, 0600); err != nil {
return fmt.Errorf("error writing catalog metadata to file: %v", err)
}
return nil
Expand Down

0 comments on commit 60d26ed

Please sign in to comment.