alingse / sundrylint

three thousand real world bug linter
MIT License
4 stars 0 forks source link

Collect 10 Real World Bugs #1

Open alingse opened 8 months ago

alingse commented 8 months ago

I want to collect 10 or 100 real world bugs and try add it to golangci-lint

TimeParse

RangeAppendAll

ldez commented 4 months ago

FYI the example you are using:

for _, n := range ns {
   rs = append(rs, n)   
   rs = append(rs, ns...)
}

The 2 lines are wrong, in this context the right code is to remove the for:

rs = append(rs, ns...)

A better example could be:

for _, n := range ns {
    if v == "value" {
        rs = append(rs, n)     // OK
        rs = append(rs, ns...) // Bug
    }
}