Skip to content

Commit 4c9db14

Browse files
authored
Merge pull request #41 from matsuri-tech/feat/lint-and-format
feat: todoに入れてたlintを適用
2 parents cfc79af + 435fe7c commit 4c9db14

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ jobs:
2222
uses: golangci/golangci-lint-action@v4
2323
with:
2424
version: latest
25-
args: --config=.golangci.yml -v --timeout 10m
25+
args: --config=.golangci.yml -v --timeout 1m

.golangci.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
linters:
2-
# disable-all: true
32
enable:
43
- gofumpt
54
- durationcheck
65
- forcetypeassert
7-
# TODO: そのうち入れたいlinterのオプション
8-
# - gocognit
9-
# - goconst
10-
# - gocritic
11-
# - disabled-checks:
12-
# - captLocal
13-
# - gochecknoglobals
14-
# - errorlint
15-
# - exhaustive
16-
# - funlen
6+
- gocognit
7+
- goconst
8+
- gocritic
9+
- gochecknoglobals
10+
- errorlint
11+
- exhaustive
1712
issues:
1813
max-same-issues: 0
19-
exclude-rules:
20-
# Exclude some linters from running on tests files.
21-
- path: _test\.go
22-
linters:
23-
- forcetypeassert

endpoints.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,18 @@ func (e *endpoints) generateOpenApiSchema(config OpenApiGeneratorConfig) (openap
228228
item = paths[path]
229229
}
230230

231-
if api.Method == http.MethodGet {
231+
switch api.Method {
232+
case http.MethodGet:
232233
item.Get = &operation
233-
} else if api.Method == http.MethodPost {
234+
case http.MethodPost:
234235
item.Post = &operation
235236
operation.RequestBody = &requestBodyAny
236-
} else if api.Method == http.MethodPut {
237+
case http.MethodPut:
237238
item.Put = &operation
238239
operation.RequestBody = &requestBodyAny
239-
} else if api.Method == http.MethodDelete {
240+
case http.MethodDelete:
240241
item.Delete = &operation
241-
} else if api.Method == http.MethodPatch {
242+
case http.MethodPatch:
242243
item.Patch = &operation
243244
operation.RequestBody = &requestBodyAny
244245
}

0 commit comments

Comments
 (0)