spatial-go / geoos

A library provides spatial data and geometric algorithms
http://www.spatial-go.com
GNU Lesser General Public License v2.1
612 stars 130 forks source link

Fix: append all slice data when range for it #111

Open alingse opened 2 months ago

alingse commented 2 months ago

TLDR: FIx a bug

I am writing a linter called sundrylint to address some real-world bugs that I discovered during my work.

When we range over a slice and call the append function within the loop body, we are not appending all elements, but only the ones that we specifically iterate over during the range operation.

for _, n := range ns {
   rs = append(rs, n)       # this is mostly wanted
   rs = append(rs, ns...)   # this is wrong
}

I read the code in here and I think it was just want to append the not IsCollinear ip