Skip to content

Commit

Permalink
ci: add nilness check in govet (#86)
Browse files Browse the repository at this point in the history
* fix(server): check db error correctly in handlerGetRepo

* ci: add nilness check in govet
  • Loading branch information
taoky authored Jul 23, 2024
1 parent d1bb184 commit 63bdc74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ linters-settings:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/ustclug/Yuki)
govet:
enable:
- nilness
exhaustive:
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
explicit-exhaustive-switch: true
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/repo_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *Server) handlerGetRepo(c echo.Context) error {
Where(model.Repo{Name: name}).
Limit(1).
Find(&repo)
if err != nil {
if res.Error != nil {
const msg = "Fail to get Repo"
l.Error(msg, slogErrAttr(err))
return newHTTPError(http.StatusInternalServerError, msg)
Expand Down

0 comments on commit 63bdc74

Please sign in to comment.