Skip to content

Conversation

@ldez
Copy link
Member

@ldez ldez commented Aug 5, 2022

Fixes #3066

@ldez ldez added bug Something isn't working area: CLI Related to CLI labels Aug 5, 2022
Copy link
Member

@bombsimon bombsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Do you know what change made the command not exit successfully after returning nil? Just pondering if it's worth adding some details to why we have to do this

@ldez
Copy link
Member Author

ldez commented Aug 5, 2022

Do you know what change made the command not exit successfully after returning nil?

It's because the version is displayed inside the preRun so a return nil will not stop the run.

if e.cfg.Run.PrintVersion {
_, _ = fmt.Fprintf(logutils.StdOut, "golangci-lint has version %s built from %s on %s\n", e.version, e.commit, e.date)
return nil
os.Exit(exitcodes.Success) // a return nil is not enough to stop the process because we are inside the `preRun`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, I wondered why we did a return instead of just an exit here :)

@ldez ldez merged commit da3b149 into golangci:master Aug 5, 2022
@ldez ldez deleted the fix/version-hang branch August 5, 2022 13:49
SeigeC pushed a commit to SeigeC/golangci-lint that referenced this pull request Apr 4, 2023
@ldez ldez added this to the v1.49 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: CLI Related to CLI bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

golangci-lint run --version hangs instead of exiting

3 participants