Minor naming and control flow changes to satisfy golint

This commit is contained in:
Tolga Ceylan
2017-11-02 15:30:07 -07:00
parent d6078f3c8f
commit a530cd9be3
10 changed files with 67 additions and 68 deletions

View File

@@ -43,10 +43,10 @@ func (c *Config) Scan(value interface{}) error {
if len(b) > 0 {
return json.Unmarshal(b, c)
} else {
*c = nil
return nil
}
*c = nil
return nil
}
// otherwise, return an error
@@ -85,10 +85,10 @@ func (h *Headers) Scan(value interface{}) error {
if len(b) > 0 {
return json.Unmarshal(b, h)
} else {
*h = nil
return nil
}
*h = nil
return nil
}
// otherwise, return an error

View File

@@ -31,10 +31,8 @@ func (m Reason) validateReasonEnum(path, location string, value Reason) error {
reasonEnum = append(reasonEnum, v)
}
}
if err := validate.Enum(path, location, value, reasonEnum); err != nil {
return err
}
return nil
err := validate.Enum(path, location, value, reasonEnum)
return err
}
// Validate validates this reason

View File

@@ -72,19 +72,19 @@ func (r *Route) Validate() error {
if r.Path == "" {
return ErrRoutesMissingPath
} else {
u, err := url.Parse(r.Path)
if err != nil {
return ErrPathMalformed
}
}
if strings.Contains(u.Path, ":") {
return ErrFoundDynamicURL
}
u, err := url.Parse(r.Path)
if err != nil {
return ErrPathMalformed
}
if !path.IsAbs(u.Path) {
return ErrRoutesInvalidPath
}
if strings.Contains(u.Path, ":") {
return ErrFoundDynamicURL
}
if !path.IsAbs(u.Path) {
return ErrRoutesInvalidPath
}
if r.Image == "" {