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

Support autofix in golangici-lint #29

Open
mitar opened this issue Sep 6, 2024 · 12 comments
Open

Support autofix in golangici-lint #29

mitar opened this issue Sep 6, 2024 · 12 comments

Comments

@mitar
Copy link

mitar commented Sep 6, 2024

This would be great, so that linter could just autofix the issues.

@catenacyber
Copy link
Owner

It is already there, like perfsprint -h shows you the flag like fix

@mitar
Copy link
Author

mitar commented Sep 6, 2024

Hm, it is not in golangci-lint:

perfsprint: Checks that fmt.Sprintf can be replaced with a faster alternative. [fast: false, auto-fix: false]

@ccoVeille
Copy link

I think you are looking for

@mitar
Copy link
Author

mitar commented Sep 6, 2024

So the issue is that golangci-lint does not support SuggestedFixes, but some other linters are doing auto-fixing in some other way then?

@ccoVeille
Copy link

Yes, so it's not an issue that can be addressed in perfsprint

And the ticket already exists in golangci-lint

I'm unsure what is the latest status. I mean I'm unsure if they were not awaiting something to be merged in Go std lib

@mitar
Copy link
Author

mitar commented Sep 8, 2024

Thanks.

@mitar mitar closed this as completed Sep 8, 2024
@catenacyber
Copy link
Owner

Thanks Christophe for answering better and faster than me

@ccoVeille
Copy link

Unless ... I was totally wrong

golangci/golangci-lint#4994 (comment)

Here is what is recommended apparently https://github.com/4meepo/tagalign/blob/e25313ba1e10f624375cf2573cdcf07473178606/tagalign.go#L163-L173

I think I had also misunderstood and expected golangci-lint to support suggestedfixes, but it's the opposite, it might be to each linter to support the golangci-lint format

@mitar
Copy link
Author

mitar commented Sep 9, 2024

I mean, or we wait for golangci-lint to support suggestedfixes, or this linter implements custom API golangci-lint requires now.

@ccoVeille
Copy link

Exactly. But I think it's a simpler move to try supporting the golangci-lint mode maybe

@catenacyber
Copy link
Owner

a PR is welcome if you want golangci-lint mode :-)

@mitar
Copy link
Author

mitar commented Sep 10, 2024

Let's then reopen this.

@mitar mitar reopened this Sep 10, 2024
@mitar mitar changed the title Support autofix Support autofix in golangi-ci Sep 10, 2024
@mitar mitar changed the title Support autofix in golangi-ci Support autofix in golangici-lint Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants