Satisfy Staticcheck

This commit is contained in:
Thomas Miceli
2023-04-26 23:13:11 +02:00
parent 09507500a9
commit 91db4dcd30
6 changed files with 29 additions and 18 deletions

View File

@ -20,9 +20,7 @@ func gistInit(next echo.HandlerFunc) echo.HandlerFunc {
userName := ctx.Param("user")
gistName := ctx.Param("gistname")
if strings.HasSuffix(gistName, ".git") {
gistName = strings.TrimSuffix(gistName, ".git")
}
gistName = strings.TrimSuffix(gistName, ".git")
gist, err := models.GetGist(userName, gistName)
if err != nil {
@ -123,7 +121,8 @@ func allGists(ctx echo.Context) error {
} else {
setData(ctx, "htmlTitle", "All gists from "+fromUserStr)
fromUser, err := models.GetUserByUsername(fromUserStr)
var fromUser *models.User
fromUser, err = models.GetUserByUsername(fromUserStr)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return notFound("User not found")