catenacyber / perfsprint

Golang linter to use strconv
MIT License
20 stars 2 forks source link

Support autofix in golangici-lint #29

Open mitar opened 3 weeks ago

mitar commented 3 weeks ago

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

catenacyber commented 3 weeks ago

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

mitar commented 3 weeks ago

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 commented 3 weeks ago

I think you are looking for

mitar commented 3 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

Thanks.

catenacyber commented 2 weeks ago

Thanks Christophe for answering better and faster than me

ccoVeille commented 2 weeks ago

Unless ... I was totally wrong

https://github.com/golangci/golangci-lint/pull/4994#issuecomment-2338412029

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 commented 2 weeks ago

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

ccoVeille commented 2 weeks ago

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

catenacyber commented 2 weeks ago

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

mitar commented 2 weeks ago

Let's then reopen this.