Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add exhaustive switch statement linter #1557

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
run: |
set -x
go install honnef.co/go/tools/cmd/staticcheck@latest
go install github.com/nishanths/exhaustive/cmd/exhaustive@latest
make static
- name: Check gosec
run: |
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dev-deps: ## Install developer dependencies
@go install github.com/securego/gosec/v2/cmd/gosec@latest
@go install honnef.co/go/tools/cmd/staticcheck@latest
@go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
@go install github.com/nishanths/exhaustive/cmd/exhaustive@latest

deps: ## Install dependencies.
@go mod download
Expand Down Expand Up @@ -54,6 +55,7 @@ unused: dev-deps # Look for unused code

static: dev-deps
staticcheck ./...
exhaustive ./...

generate: dev-deps
go generate ./...
Expand Down
1 change: 1 addition & 0 deletions internal/api/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (a *API) Logout(w http.ResponseWriter, r *http.Request) error {
return terr
}

//exhaustive:ignore Default case is handled below.
hf marked this conversation as resolved.
Show resolved Hide resolved
switch scope {
case LogoutLocal:
return models.LogoutSession(tx, s.ID)
Expand Down
2 changes: 1 addition & 1 deletion internal/observability/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func setPopLogger(sql string) {
}

switch lvl {
case logging.Debug:
case logging.SQL, logging.Debug:
l.Debug(s)
case logging.Info:
l.Info(s)
Expand Down
Loading