mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Minor naming and control flow changes to satisfy golint
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 == "" {
|
||||
|
||||
Reference in New Issue
Block a user