Skip to content

Add support for golangci-lint init #4057

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

Closed
remyleone opened this issue Sep 1, 2023 · 3 comments
Closed

Add support for golangci-lint init #4057

remyleone opened this issue Sep 1, 2023 · 3 comments
Labels
enhancement New feature or improvement won't fix This will not be worked on

Comments

@remyleone
Copy link

Your feature request related to a problem? Please describe.

When I'm bootstrapping a project, I would like to create a default golangci-lint configuration file. The problem is that I don't have a quick command to type that will create this default configuration file for me.

Describe the solution you'd like.

I would like to have a command such as:

golangci-lint init

or even

golangci-lint config init

Once this command is run, a .golangci-lint.yml file is created inside my current directory. Then I can run golangci-lint and it will natively pick up this file.

Describe alternatives you've considered.

I could copy and paste from previous project but the problem is that linters come and go and it is not easy to know which one are deprecated and the one that are still used.
With an init command I would always be sure to have the latest and recommended linters enabled for my project

Additional context.

No response

@remyleone remyleone added the enhancement New feature or improvement label Sep 1, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Sep 1, 2023

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@ldez ldez added the won't fix This will not be worked on label Mar 3, 2024
@ldez
Copy link
Member

ldez commented Mar 3, 2024

I could copy and paste from previous project but the problem is that linters come and go and it is not easy to know which one are deprecated and the one that are still used.

There are 10 deprecated linters on 113:

  • ifshort (2022)
  • structcheck (2022)
  • varcheck (2022)
  • deadcode (2022)
  • exhaustivestruct (2022)
  • nosnakecase (2022)
  • golint (2021)
  • maligned (2021)
  • interfacer (2021)
  • scopelint (2021)

We can improve the deprecated workflow but deprecating a linter happens very rarely.
The majority have been deprecated because of missing support of generics (related to go1.18 in 2022).

There are new linters often but it's a user's choice to enable them or not.
We improved the doc with the Since attribute to provide information to help with that.
https://golangci-lint.run/usage/linters/

We can do better, and we will do better.

The problem is that I don't have a quick command to type that will create this default configuration file for me.

The only default configuration golangci-lint has is no configuration file: the set of default linters.

With an init command I would always be sure to have the latest and recommended linters enabled for my project

There are no recommended linters: the right linters and the right configuration depend on projects and users' preferences.

I think the real need behind this issue is the same as #1141.

@ldez ldez closed this as completed Mar 3, 2024
@bombsimon
Copy link
Member

Here's a fairly new discussion about the topic of getting a default config as well #4393

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants