Mercurial > gemma
changeset 1186:ba0d8c327b0b
Made code more idiomatic.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 15 Nov 2018 18:30:46 +0100 |
parents | 7e6fce79ddc8 |
children | f7131eeb2a53 |
files | pkg/octree/contours.go |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/octree/contours.go Thu Nov 15 18:27:27 2018 +0100 +++ b/pkg/octree/contours.go Thu Nov 15 18:30:46 2018 +0100 @@ -27,7 +27,7 @@ cond *sync.Cond } -func NewContorResult(height float64) *ContourResult { +func NewContourResult(height float64) *ContourResult { cr := ContourResult{Height: height} cr.cond = sync.NewCond(&cr.mu) return &cr @@ -57,9 +57,10 @@ func DoContours(tree *Tree, heights []float64, store func(*ContourResult)) { - var contours []*ContourResult - for i := 0; i < len(heights); i++ { - contours = append(contours, NewContorResult(heights[i])) + contours := make([]*ContourResult, len(heights)) + + for i, h := range heights { + contours[i] = NewContourResult(h) } jobs := make(chan *ContourResult)