Enforce Go style rules across codebase
Apply five style rules: convert iota string enums to typed string constants, replace errors.As with errors.AsType, merge three-group imports into two groups, fix multiline parameter/argument formatting, and replace fmt.Sprintf URL construction with net/url. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -143,11 +143,9 @@ func Conflictf(ctx context.Context, format string, a ...any) *gqlerror.Error {
|
||||
}
|
||||
|
||||
func Invalid(ctx context.Context, err error) *gqlerror.Error {
|
||||
var errValidation *validator.ValidationError
|
||||
|
||||
var details map[string]any
|
||||
|
||||
if errors.As(err, &errValidation) {
|
||||
if errValidation, ok := errors.AsType[*validator.ValidationError](err); ok {
|
||||
details = map[string]any{
|
||||
"cause": errValidation.Code,
|
||||
"field": errValidation.Field,
|
||||
|
||||
Reference in New Issue
Block a user