1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Make sure golint pass on the code base

This commit is contained in:
Frédéric Guillot 2017-11-27 21:30:04 -08:00
parent 8781648af9
commit bb8e61c7c5
59 changed files with 322 additions and 171 deletions

View file

@ -5,9 +5,10 @@
package form
import (
"errors"
"github.com/miniflux/miniflux2/model"
"net/http"
"github.com/miniflux/miniflux2/errors"
"github.com/miniflux/miniflux2/model"
)
// CategoryForm represents a feed form in the UI
@ -15,18 +16,21 @@ type CategoryForm struct {
Title string
}
// Validate makes sure the form values are valid.
func (c CategoryForm) Validate() error {
if c.Title == "" {
return errors.New("The title is mandatory.")
return errors.NewLocalizedError("The title is mandatory.")
}
return nil
}
// Merge update the given category fields.
func (c CategoryForm) Merge(category *model.Category) *model.Category {
category.Title = c.Title
return category
}
// NewCategoryForm returns a new CategoryForm.
func NewCategoryForm(r *http.Request) *CategoryForm {
return &CategoryForm{
Title: r.FormValue("title"),