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,24 +5,28 @@
package form
import (
"errors"
"net/http"
"strconv"
"github.com/miniflux/miniflux2/errors"
)
// SubscriptionForm represents the subscription form.
type SubscriptionForm struct {
URL string
CategoryID int64
}
// Validate makes sure the form values are valid.
func (s *SubscriptionForm) Validate() error {
if s.URL == "" || s.CategoryID == 0 {
return errors.New("The URL and the category are mandatory.")
return errors.NewLocalizedError("The URL and the category are mandatory.")
}
return nil
}
// NewSubscriptionForm returns a new SubscriptionForm.
func NewSubscriptionForm(r *http.Request) *SubscriptionForm {
categoryID, err := strconv.Atoi(r.FormValue("category_id"))
if err != nil {