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

🔧 Configure golangci-lint #770

Merged
merged 5 commits into from
Jun 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
14 changes: 14 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ jobs:
- name: Build
run: go build -v

lint:
name: Lint
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- uses: golangci/golangci-lint-action@v6
with:
version: latest

test:
name: Test
runs-on: ubuntu-latest
Expand Down
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
linters:
disable-all: true
enable:
# https://golangci-lint.run/usage/linters/#enabled-by-default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- unused
# https://golangci-lint.run/usage/linters/#disabled-by-default
- gofmt
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
} else {
logger, err = zap.NewProduction()
}
defer logger.Sync()
defer func() {
if err := logger.Sync(); err != nil {
panic(err)

Check warning on line 52 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L50-L52

Added lines #L50 - L52 were not covered by tests
}
}()
if err != nil {
panic(err)
}
Expand Down
1 change: 1 addition & 0 deletions model/group_budget_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package model

import "github.com/traPtitech/Jomon/ent"

// nolint:unused
func convertEntGroupBudgetToModelGroupBudget(entgb *ent.GroupBudget) *GroupBudget {
if entgb == nil {
return nil
Expand Down
Loading