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

feat: enable override coloring based on CLICOLOR and CLICOLOR_FORCE #2657

Merged

Conversation

ttys3
Copy link
Contributor

@ttys3 ttys3 commented Mar 19, 2022

some CI runners does not support TTY, like gitlab runner.

related issue https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2115
https://gitlab.com/gitlab-org/gitlab/-/issues/28598

even with golangci-lint run -v --color always, we can not make the log level support color.

with this option, one can set env var CLICOLOR_FORCE=1 to skip the tty check and print colored log level.

and set env var CLICOLOR_FORCE=0 and CLICOLOR=0 to disable colored log level.

see https://github.com/sirupsen/logrus/blob/85981c045988a3ebe607e2f5b8a6499d86e0ddac/text_formatter.go#L120

@boring-cyborg
Copy link

@boring-cyborg boring-cyborg bot commented Mar 19, 2022

Hey, thank you for opening your first Pull Request !

@CLAassistant
Copy link

@CLAassistant CLAassistant commented Mar 19, 2022

CLA assistant check
All committers have signed the CLA.

@ldez ldez added the enhancement label Mar 19, 2022
@ldez ldez changed the title feat(log): enable override coloring based on CLICOLOR and CLICOLOR_FORCE feat: enable override coloring based on CLICOLOR and CLICOLOR_FORCE Mar 27, 2022
@ldez ldez added the area: CLI label Mar 27, 2022
ldez
ldez approved these changes Mar 29, 2022
Copy link
Member

@ldez ldez left a comment

LGTM

@ldez ldez merged commit a2e6c76 into golangci:master Apr 5, 2022
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CLI enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants