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 nilness check in govet #86

Merged
merged 2 commits into from
Jul 23, 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
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