diff --git a/.golangci.yml b/.golangci.yml index cb221b7..c242661 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 diff --git a/pkg/server/repo_handlers.go b/pkg/server/repo_handlers.go index b369e6f..ce269ac 100644 --- a/pkg/server/repo_handlers.go +++ b/pkg/server/repo_handlers.go @@ -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)