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

Upgrade to golangci-lint 1.61.0 #592

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Commits on Sep 15, 2024

  1. Upgrade to golangci-lint 1.61.0

    I accidentally upgraded my golangci-lint locally, so figured I may as
    well take it up a version in CI as well.
    
    The main new drama queen for this version is fatcontext [1]. It looks
    like it's a well-intentioned lint, which tries to avoid having callers
    set context in loops and inadvertently create a super deep context that
    causes performance issues:
    
        func notOk() {
                ctx := context.Background()
    
                for i := 0; i < 10; i++ {
                        ctx = context.WithValue(ctx, "key", i) // "nested context in loop"
                        _ = ctx
                }
        }
    
    Unfortunately, as with many well-intentioned golangci-lint additions,
    its heuristic is overly broad, and it produces a lot of false positives
    (in fact, 100% of lines it found were false positives). I've marked
    lines `nolint:fatcontext` for now, but this may be one that we disable
    if it gets too annoying because it's almost certainly more cost than
    benefit.
    
    The good news is that we get upgraded version of `gosec`, and some of
    the lines that were marked as `nolint` and which were false positives
    on unsafe integer conversion (they were always safe) can be removed.
    
    [1] https://github.com/Crocmagnon/fatcontext
    brandur committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    a7c1c09 View commit details
    Browse the repository at this point in the history