Can someone explain why this is illegal (./cluster.go:40: invalid

continue label ATTEMPT)? Should I just be using goto here? My use here

feels sane, and continue indicates what I mean, but it seems that the

label must immediately precede the for loop - is this the case? It seems

restrictive.

thanks

Dan

func ClusterFeaturePairs(p []*pals.FeaturePair, epsilon float64, effort int) (pc [][]*pals.FeaturePair, rf []*feat.Feature) {

km := kmeans.NewKmeans(Pairs(p))

values := km.Values()

cut := make([]float64, len(values))

for i, v := range values {

l := epsilon * (v.Y() - v.X())

cut[i] = l * l

}

for k := 1; k <= len(p); k++ {

ATTEMPT:

var e int

if k == 1 {

e = 1

} else {

e = effort

}

for attempt := 0; attempt < e; attempt++ {

km.Seed(k)

km.Cluster()

centers := km.Means()

for i, v := range values {

dx, dy := centers[v.Cluster()].X()-v.X(), centers[v.Cluster()].Y()-v.Y()

ok := dx*dx+dy*dy < cut[i]

if !ok {

continue ATTEMPT

}

}

pc = make([][]*pals.FeaturePair, k)

rf = make([]*feat.Feature, k)

for ci, c := range km.Clusters() {

rf[ci] = &feat.Feature{Location: p[0].A.Location, Start: int(centers[ci].X()), End: int(centers[ci].Y())}

pc[ci] = make([]*pals.FeaturePair, centers[ci].Count())

for pi, i := range c {

pc[ci][pi] = p[i]

}

}

return

}

}

panic("cannot reach")

}

--