Commit da2e38da authored by ale's avatar ale

Fix lint warnings

parent 28476a76
...@@ -281,7 +281,8 @@ func (v *validationContext) isAvailableEmailAddr() ValidatorFunc { ...@@ -281,7 +281,8 @@ func (v *validationContext) isAvailableEmailAddr() ValidatorFunc {
if err != nil { if err != nil {
return err return err
} }
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // Errors will cause to consider the address unavailable.
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // nolint
return errors.New("address unavailable") return errors.New("address unavailable")
} }
return nil return nil
...@@ -298,7 +299,8 @@ func (v *validationContext) isAvailableDomain() ValidatorFunc { ...@@ -298,7 +299,8 @@ func (v *validationContext) isAvailableDomain() ValidatorFunc {
if err != nil { if err != nil {
return err return err
} }
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // Errors will cause to consider the resource unavailable.
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // nolint
return errors.New("address unavailable") return errors.New("address unavailable")
} }
return nil return nil
...@@ -315,7 +317,8 @@ func (v *validationContext) isAvailableWebsite() ValidatorFunc { ...@@ -315,7 +317,8 @@ func (v *validationContext) isAvailableWebsite() ValidatorFunc {
if err != nil { if err != nil {
return err return err
} }
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // Errors will cause to consider the resource unavailable.
if ok, _ := tx.HasAnyResource(ctx, rel); ok { // nolint
return errors.New("address unavailable") return errors.New("address unavailable")
} }
return nil return nil
...@@ -365,6 +368,8 @@ func allOf(funcs ...ValidatorFunc) ValidatorFunc { ...@@ -365,6 +368,8 @@ func allOf(funcs ...ValidatorFunc) ValidatorFunc {
// various fields in a Resource, depending on its type. // various fields in a Resource, depending on its type.
type ResourceValidatorFunc func(context.Context, *Resource, *User) error type ResourceValidatorFunc func(context.Context, *Resource, *User) error
// The linter thinks this function is too complex.
// nolint: gocyclo
func (v *validationContext) validateResource(_ context.Context, r *Resource, user *User) error { func (v *validationContext) validateResource(_ context.Context, r *Resource, user *User) error {
// Resource name must match the name in the resource ID // Resource name must match the name in the resource ID
// (until we get rid of the Name field). // (until we get rid of the Name field).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment