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

Tab output format without a color #3728

Closed
cristaloleg opened this issue Mar 25, 2023 · 5 comments · Fixed by #3729
Closed

Tab output format without a color #3728

cristaloleg opened this issue Mar 25, 2023 · 5 comments · Fixed by #3729
Labels
area: output Related to issue output enhancement New feature or improvement

Comments

@cristaloleg
Copy link
Contributor

cristaloleg commented Mar 25, 2023

Your feature request related to a problem? Please describe.

I started writing a blog post regarding my golangci-lint setup and decided to try the tab format, which looks cool and I like it.

I tried the following config and was upset because my lint.txt is full of cryptic symbols related to the colouring (see screenshot)

output:
  format: tab:lint.txt

image

Describe the solution you'd like.

Add a new format which outputs results in the tab format but without colours, so no cryptic symbols appear in the output file.

Describe alternatives you've considered.

Keep using line-number or using a personal fork without colours. This can be also sed-ed but I don't like this fix.

Additional context.

I'm happy to make a PR, I'm just not sure which fix would be better: add a new tab-no-colour format or add a separate config field no-color: <boolean> or just join https://no-color.org/ movement.

@cristaloleg cristaloleg added the enhancement New feature or improvement label Mar 25, 2023
@ldez
Copy link
Member

ldez commented Mar 25, 2023

Hello,

I created PR #3729.

I don't introduce a no-color option because I prefer to have a consistent and homogenous option.
Today we already have colored-line-number and line-number.

Also, you can already use the env var NO_COLOR to disable the color.
This option is related to github.com/fatih/color, and there are other existing conditions.

@ldez ldez added the area: output Related to issue output label Mar 25, 2023
@ldez
Copy link
Member

ldez commented Mar 25, 2023

I missed one existing option because this option was not documented:

--color never

I will document that.

And I think we will have to review this global approach to color and output.

@ldez
Copy link
Member

ldez commented Mar 25, 2023

In fact, the option color only works as a CLI flag: --color never

The config file version doesn't work, and I don't know why, probably a historical reason.

@ldez
Copy link
Member

ldez commented Mar 25, 2023

I think I know why: the option has been probably introduced to handle colors inside logs but as this option is modifying the global var color.NoColor it also impacts the report outputs which use the same library.
The setup of the logs is handled before the configuration file parsing, this explains why the config file option doesn't work.

So this option cannot be documented in the reference file, and will always work only with CLI flags like the --verbose option.

@cristaloleg
Copy link
Contributor Author

Well, my feature is completely done in #3729. A global no-color parameter was just 1 way to achieve my goal.

@ldez ldez closed this as completed in #3729 Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: output Related to issue output enhancement New feature or improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants