Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ForceCuddleErrCheckAndAssign only for single lines #86

Closed
bombsimon opened this issue May 12, 2020 · 1 comment
Closed

ForceCuddleErrCheckAndAssign only for single lines #86

bombsimon opened this issue May 12, 2020 · 1 comment
Assignees
Labels
golangci-only Fixed in wsl but not merged to golangci-lint

Comments

@bombsimon
Copy link
Owner

Currently ForceCuddleErrCheckAndAssign enforces errors to be cuddled with the assigning statement no matter how many lines it spans over. While my idea was to enforce this:

err := json.Unmarshal(body, &data)
if err != nil {
    panic(err)
}

This is now also enforced with ForceCuddleErrCheckAndAssign set to true:

err := db.
    Where(&SomeType{
        SomeColumn: true,
    }).
    Preload("AnotherTable").
    Find(&data).Error
if err != nil {
    panic(err)
}

Since the err assignment spans over so many lines I think it should be optional or configurable to leave a space between the assignment an if statement even when ForceCuddleErrCheckAndAssign is set to true.

@bombsimon bombsimon self-assigned this May 12, 2020
@bombsimon bombsimon added the golangci-only Fixed in wsl but not merged to golangci-lint label May 20, 2020
@bombsimon
Copy link
Owner Author

Merged in golangci/golangci-lint#1750, will be available in next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
golangci-only Fixed in wsl but not merged to golangci-lint
Projects
None yet
Development

No branches or pull requests

1 participant