Skip to content

Commit

Permalink
Fix lint version & issues
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed Jan 21, 2025
1 parent 2284296 commit c132e21
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.49
version: v1.55.2

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ linters:
- revive

linters-settings:
revive:
rules:
- name: unused-parameter
disabled: true
misspell:
locale: US
gocritic:
Expand Down
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
GO ?= go

INSTALL_PATH := $(PWD)/bin

# golangci-lint
GOLANGCI_LINT_VERSION := 1.55.2
GOLANGCI_LINT_OUTPUT := $(shell $(INSTALL_PATH)/golangci-lint --version 2>/dev/null)
INSTALL_GOLANGCI_LINT := $(findstring $(GOLANGCI_LINT_VERSION), $(GOLANGCI_LINT_OUTPUT))

getdeps:
@mkdir -p $(INSTALL_PATH)
@if [ -z "$(INSTALL_GOLANGCI_LINT)" ]; then \
echo "Installing golangci-lint into ./bin/" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(INSTALL_PATH) v${GOLANGCI_LINT_VERSION} ; \
else \
echo "golangci-lint v@$(GOLANGCI_LINT_VERSION) already installed"; \
fi

all: static-check birdwatcher

birdwatcher:
Expand All @@ -12,7 +27,7 @@ birdwatcher_wkafka:
@mkdir -p bin
@CGO_ENABLED=1 go build -o bin/birdwatcher_wkafka -tags WKAFKA main.go

static-check:
static-check: getdeps
@echo "Running static-check"
@golangci-lint cache clean
@golangci-lint run --timeout=10m --config ./.golangci.yml ./...
@$(INSTALL_PATH)/golangci-lint cache clean
@$(INSTALL_PATH)/golangci-lint run --timeout=10m --config ./.golangci.yml ./...
2 changes: 1 addition & 1 deletion states/parse_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (app *ApplicationState) ValidateIndexFilesCommand(ctx context.Context, p *V
validateIndexFolder(fp, params)
}
} else if errors.Is(err, os.ErrNotExist) {
// file not exist
fmt.Println("fail not exists: ", idxParam)
} else {
fmt.Println(err.Error())
}
Expand Down

0 comments on commit c132e21

Please sign in to comment.