Skip to content

Commit

Permalink
Merge pull request #484 from albertteoh/golangci-lint-docker
Browse files Browse the repository at this point in the history
Run golangci-lint from docker-compose
  • Loading branch information
peterstace committed Dec 11, 2022
2 parents 4b0cc92 + dfb9e34 commit 62ebc9e
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .ci/docker-compose-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
context: .
dockerfile: golint.Dockerfile
working_dir: /go/src/github.com/peterstace/simplefeatures
entrypoint: golint -set_exit_status ./geom ./geos
entrypoint: golangci-lint run --max-same-issues 100
volumes:
- ..:/go/src/github.com/peterstace/simplefeatures
environment:
Expand Down
8 changes: 6 additions & 2 deletions .ci/golint.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
FROM golang:1.17
RUN go get -u golang.org/x/lint/golint
FROM golangci/golangci-lint:v1.50.1

RUN apt-get update \
&& apt-get install -y -q --no-install-recommends \
libgeos-dev \
&& rm -rf /var/lib/apt/lists/*
18 changes: 0 additions & 18 deletions .github/workflows/golangci-lint.yml

This file was deleted.

30 changes: 27 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
run:
timeout: 5m

issues:
exclude-rules:
- path: 'internal'
linters:
- gosec
- path: '(.+)_test\.go'
linters:
- gosec

linter-settings:
depguard:
list-type: blacklist
include-go-root: true
packages:
- io/ioutil
packages-with-error-message:
- io/ioutil: "Use os or io instead of io/ioutil"
goimports:
local-prefixes: github.com/peterstace/simplefeatures
gosimple:
go: "1.16"
go: "1.17"
checks: ["all"]

linters:
fast: false
disable:
- errcheck
enable:
- govet
- bidichk
- contextcheck
- depguard
- gofmt
- goimports
- gofumpt
- goimports
- gosec
- govet
- misspell
1 change: 0 additions & 1 deletion geom/alg_set_op_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,6 @@ func TestBinaryOpBothInputsEmpty(t *testing.T) {
t.Errorf("got=%v but want=FFFFFFFF2", got)
}
})

})
}
}
Expand Down
2 changes: 0 additions & 2 deletions geom/attr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ func TestCoordinatesSequence(t *testing.T) {
expectXYEq(t, seq[1].GetXY(1), XY{2, 7})
expectXYEq(t, seq[1].GetXY(2), XY{7, 2})
expectXYEq(t, seq[1].GetXY(3), XY{2, 2})

})
t.Run("multipoint", func(t *testing.T) {
seq := geomFromWKT(t, "MULTIPOINT(0 1,2 3,EMPTY,4 5)").MustAsMultiPoint().Coordinates()
Expand Down Expand Up @@ -624,7 +623,6 @@ func TestSignedArea(t *testing.T) {
}
})
}

}

func TestTransformedArea(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion geom/dcel_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ func (d *doublyConnectedEdgeList) addLineString(ls LineString, operand operand,
}
}
}

})
}

Expand Down
6 changes: 4 additions & 2 deletions geom/twkb_export_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package geom

var DecodeZigZagInt64 = decodeZigZagInt64
var EncodeZigZagInt64 = encodeZigZagInt64
var (
DecodeZigZagInt64 = decodeZigZagInt64
EncodeZigZagInt64 = encodeZigZagInt64
)
2 changes: 1 addition & 1 deletion geom/twkb_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ func (p *twkbParser) parsePointCountAndArray() ([]float64, int, error) {
// Utilise and update the running memory of the previous reference point.
// The returned array will contain numPoints * the number of dimensions values.
func (p *twkbParser) parsePointArray(numPoints int) ([]float64, error) {
var coords = make([]float64, numPoints*int(p.dimensions))
coords := make([]float64, numPoints*int(p.dimensions))
c := 0
for i := 0; i < numPoints; i++ {
for d := 0; d < p.dimensions; d++ {
Expand Down
1 change: 0 additions & 1 deletion geom/twkb_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
// Options can be supplied to control whether headers can be added, or
// to control the precision of Z or M coordinates.
func MarshalTWKB(g Geometry, precXY int, opts ...TWKBWriterOption) ([]byte, error) {

var s twkbWriterOptionSet
s.precZ = precXY // Default if not set by opt.
s.precM = precXY // Default if not set by opt.
Expand Down
2 changes: 1 addition & 1 deletion geom/type_geometry_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (c GeometryCollection) ConvexHull() Geometry {
// this geometry as a GeoJSON geometry object.
func (c GeometryCollection) MarshalJSON() ([]byte, error) {
buf := []byte(`{"type":"GeometryCollection","geometries":`)
var geoms = c.geoms
geoms := c.geoms
if geoms == nil {
geoms = []Geometry{}
}
Expand Down
3 changes: 2 additions & 1 deletion geom/type_line_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ func validateLineStringSeq(seq Sequence) error {
}
if !hasAtLeast2DistinctPointsInSeq(seq) {
return validationError{
"non-empty linestring contains only one distinct XY value"}
"non-empty linestring contains only one distinct XY value",
}
}
if err := seq.validate(); err != nil {
return validationError{err.Error()}
Expand Down
1 change: 1 addition & 0 deletions geom/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func expectXYEq(t testing.TB, got, want XY) {
t.Errorf("\ngot: %v\nwant: %v\n", got, want)
}
}

func expectXYWithinTolerance(t testing.TB, got, want XY, tolerance float64) {
t.Helper()
if delta := math.Abs(got.Sub(want).Length()); delta > tolerance {
Expand Down
1 change: 0 additions & 1 deletion geom/wkb_marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func init() {
default:
panic(fmt.Sprintf("unexpected buf[0]: %d", buf[0]))
}

}

type wkbMarshaler struct {
Expand Down
3 changes: 2 additions & 1 deletion geos/entrypoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ func SymmetricDifference(a, b geom.Geometry, opts ...geom.ConstructorOption) (ge
func MakeValid(g geom.Geometry, opts ...geom.ConstructorOption) (geom.Geometry, error) {
if C.MAKE_VALID_MISSING != 0 {
return geom.Geometry{}, unsupportedGEOSVersionError{
C.MAKE_VALID_MIN_VERSION, "MakeValid"}
C.MAKE_VALID_MIN_VERSION, "MakeValid",
}
}
result, err := unaryOpG(g, opts, func(ctx C.GEOSContextHandle_t, g *C.GEOSGeometry) *C.GEOSGeometry {
return C.GEOSMakeValid_r(ctx, g)
Expand Down
27 changes: 18 additions & 9 deletions geos/entrypoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,39 +682,48 @@ func TestBuffer(t *testing.T) {
"POLYGON((-0.5 0,-0.5 10,-0.4903926402016152 10.097545161008064,-0.46193976625564337 10.191341716182546,-0.4157348061512727 10.2777851165098,-0.35355339059327373 10.353553390593273,-0.277785116509801 10.415734806151272,-0.19134171618254486 10.461939766255643,-0.0975451610080641 10.490392640201616,0 10.5,10 10.5,10.097545161008064 10.490392640201616,10.191341716182546 10.461939766255643,10.2777851165098 10.415734806151272,10.353553390593273 10.353553390593273,10.415734806151272 10.2777851165098,10.461939766255643 10.191341716182546,10.490392640201616 10.097545161008064,10.5 10,10.5 0,10.490392640201616 -0.09754516100806412,10.461939766255643 -0.1913417161825449,10.415734806151272 -0.2777851165098011,10.353553390593273 -0.35355339059327373,10.2777851165098 -0.4157348061512726,10.191341716182546 -0.46193976625564337,10.097545161008064 -0.4903926402016152,10 -0.5,0 -0.5,-0.09754516100806378 -0.49039264020161527,-0.19134171618254414 -0.4619397662556437,-0.2777851165098001 -0.41573480615127334,-0.3535533905932726 -0.3535533905932749,-0.41573480615127156 -0.2777851165098027,-0.4619397662556424 -0.1913417161825472,-0.49039264020161466 -0.09754516100806691,-0.5 0),(1.5 1.5,8.5 1.5,8.5 8.5,1.5 8.5,1.5 1.5))",
},
{
"POINT(1 1)", 0.5, []BufferOption{BufferQuadSegments(2)},
"POINT(1 1)", 0.5,
[]BufferOption{BufferQuadSegments(2)},
"POLYGON((1.5 1,1.353553390593274 0.6464466094067265,1.0000000000000009 0.5,0.646446609406727 0.6464466094067254,0.5 0.9999999999999983,0.6464466094067247 1.3535533905932722,0.9999999999999977 1.5,1.3535533905932717 1.3535533905932757,1.5 1))",
},
{
"LINESTRING(0 0,1 1)", 0.1, []BufferOption{ /*BufferEndCapRound()*/ },
"LINESTRING(0 0,1 1)", 0.1,
[]BufferOption{ /*BufferEndCapRound()*/ },
"POLYGON((0.9292893218813453 1.0707106781186548,0.9444429766980399 1.0831469612302547,0.9617316567634911 1.0923879532511287,0.9804909677983873 1.0980785280403231,1 1.1,1.019509032201613 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302544,1.0707106781186548 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.038268343236509,1.0980785280403231 1.019509032201613,1.1 1,1.0980785280403231 0.9804909677983873,1.0923879532511287 0.9617316567634911,1.0831469612302547 0.9444429766980399,1.0707106781186548 0.9292893218813453,0.07071067811865475 -0.07071067811865475,0.05555702330196012 -0.0831469612302546,0.03826834323650888 -0.09238795325112872,0.019509032201612746 -0.09807852804032308,-0.00000000000000006049014748177263 -0.1,-0.019509032201612864 -0.09807852804032305,-0.03826834323650899 -0.09238795325112868,-0.0555570233019602 -0.08314696123025456,-0.07071067811865475 -0.07071067811865477,-0.08314696123025449 -0.05555702330196029,-0.09238795325112865 -0.03826834323650903,-0.09807852804032302 -0.019509032201612948,-0.1 -0.00000000000000010106430996148606,-0.09807852804032308 0.019509032201612663,-0.09238795325112874 0.038268343236508844,-0.08314696123025465 0.055557023301960044,-0.07071067811865475 0.07071067811865475,0.9292893218813453 1.0707106781186548))",
},
{
"LINESTRING(0 0,1 1)", 0.1, []BufferOption{BufferEndCapRound()},
"LINESTRING(0 0,1 1)", 0.1,
[]BufferOption{BufferEndCapRound()},
"POLYGON((0.9292893218813453 1.0707106781186548,0.9444429766980399 1.0831469612302547,0.9617316567634911 1.0923879532511287,0.9804909677983873 1.0980785280403231,1 1.1,1.019509032201613 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302544,1.0707106781186548 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.038268343236509,1.0980785280403231 1.019509032201613,1.1 1,1.0980785280403231 0.9804909677983873,1.0923879532511287 0.9617316567634911,1.0831469612302547 0.9444429766980399,1.0707106781186548 0.9292893218813453,0.07071067811865475 -0.07071067811865475,0.05555702330196012 -0.0831469612302546,0.03826834323650888 -0.09238795325112872,0.019509032201612746 -0.09807852804032308,-0.00000000000000006049014748177263 -0.1,-0.019509032201612864 -0.09807852804032305,-0.03826834323650899 -0.09238795325112868,-0.0555570233019602 -0.08314696123025456,-0.07071067811865475 -0.07071067811865477,-0.08314696123025449 -0.05555702330196029,-0.09238795325112865 -0.03826834323650903,-0.09807852804032302 -0.019509032201612948,-0.1 -0.00000000000000010106430996148606,-0.09807852804032308 0.019509032201612663,-0.09238795325112874 0.038268343236508844,-0.08314696123025465 0.055557023301960044,-0.07071067811865475 0.07071067811865475,0.9292893218813453 1.0707106781186548))",
},
{
"LINESTRING(0 0,1 1)", 0.1, []BufferOption{BufferEndCapFlat()},
"LINESTRING(0 0,1 1)", 0.1,
[]BufferOption{BufferEndCapFlat()},
"POLYGON((0.9292893218813453 1.0707106781186548,1.0707106781186548 0.9292893218813453,0.07071067811865475 -0.07071067811865475,-0.07071067811865475 0.07071067811865475,0.9292893218813453 1.0707106781186548))",
},
{
"LINESTRING(0 0,1 1)", 0.1, []BufferOption{BufferEndCapSquare()},
"LINESTRING(0 0,1 1)", 0.1,
[]BufferOption{BufferEndCapSquare()},
"POLYGON((0.9292893218813453 1.0707106781186548,1 1.1414213562373097,1.1414213562373097 1,0.07071067811865475 -0.07071067811865475,0 -0.1414213562373095,-0.1414213562373095 -0.000000000000000013877787807814457,0.9292893218813453 1.0707106781186548))",
},
{
"LINESTRING(0 0,1 0,1 1)", 0.1, []BufferOption{ /*BufferJoinStyleRound()*/ },
"LINESTRING(0 0,1 0,1 1)", 0.1,
[]BufferOption{ /*BufferJoinStyleRound()*/ },
"POLYGON((0.9 0.1,0.9 1,0.901921471959677 1.019509032201613,0.9076120467488714 1.0382683432365092,0.9168530387697456 1.0555570233019602,0.9292893218813453 1.0707106781186548,0.9444429766980398 1.0831469612302547,0.961731656763491 1.0923879532511287,0.9804909677983872 1.0980785280403231,1 1.1,1.0195090322016127 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302547,1.0707106781186546 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.0382683432365092,1.0980785280403231 1.019509032201613,1.1 1,1.1 0,1.0980785280403231 -0.019509032201612826,1.0923879532511287 -0.03826834323650898,1.0831469612302544 -0.05555702330196022,1.0707106781186548 -0.07071067811865475,1.0555570233019602 -0.08314696123025453,1.038268343236509 -0.09238795325112868,1.019509032201613 -0.09807852804032305,1 -0.1,0 -0.1,-0.019509032201612955 -0.09807852804032302,-0.03826834323650912 -0.09238795325112863,-0.055557023301960363 -0.08314696123025443,-0.07071067811865482 -0.07071067811865468,-0.08314696123025457 -0.055557023301960155,-0.0923879532511287 -0.03826834323650893,-0.09807852804032306 -0.01950903220161279,-0.1 0.000000000000000012246467991473533,-0.09807852804032305 0.01950903220161282,-0.0923879532511287 0.03826834323650895,-0.08314696123025456 0.055557023301960176,-0.07071067811865482 0.0707106781186547,-0.05555702330196031 0.08314696123025447,-0.0382683432365091 0.09238795325112864,-0.019509032201612972 0.09807852804032302,0 0.1,0.9 0.1))",
},
{
"LINESTRING(0 0,1 0,1 1)", 0.1, []BufferOption{BufferJoinStyleRound()},
"LINESTRING(0 0,1 0,1 1)", 0.1,
[]BufferOption{BufferJoinStyleRound()},
"POLYGON((0.9 0.1,0.9 1,0.901921471959677 1.019509032201613,0.9076120467488714 1.0382683432365092,0.9168530387697456 1.0555570233019602,0.9292893218813453 1.0707106781186548,0.9444429766980398 1.0831469612302547,0.961731656763491 1.0923879532511287,0.9804909677983872 1.0980785280403231,1 1.1,1.0195090322016127 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302547,1.0707106781186546 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.0382683432365092,1.0980785280403231 1.019509032201613,1.1 1,1.1 0,1.0980785280403231 -0.019509032201612826,1.0923879532511287 -0.03826834323650898,1.0831469612302544 -0.05555702330196022,1.0707106781186548 -0.07071067811865475,1.0555570233019602 -0.08314696123025453,1.038268343236509 -0.09238795325112868,1.019509032201613 -0.09807852804032305,1 -0.1,0 -0.1,-0.019509032201612955 -0.09807852804032302,-0.03826834323650912 -0.09238795325112863,-0.055557023301960363 -0.08314696123025443,-0.07071067811865482 -0.07071067811865468,-0.08314696123025457 -0.055557023301960155,-0.0923879532511287 -0.03826834323650893,-0.09807852804032306 -0.01950903220161279,-0.1 0.000000000000000012246467991473533,-0.09807852804032305 0.01950903220161282,-0.0923879532511287 0.03826834323650895,-0.08314696123025456 0.055557023301960176,-0.07071067811865482 0.0707106781186547,-0.05555702330196031 0.08314696123025447,-0.0382683432365091 0.09238795325112864,-0.019509032201612972 0.09807852804032302,0 0.1,0.9 0.1))",
},
{
"LINESTRING(0 0,1 0,1 1)", 0.1, []BufferOption{BufferJoinStyleMitre(0.05)},
"LINESTRING(0 0,1 0,1 1)", 0.1,
[]BufferOption{BufferJoinStyleMitre(0.05)},
"POLYGON((0.9 0.1,0.9 1,0.901921471959677 1.019509032201613,0.9076120467488714 1.0382683432365092,0.9168530387697456 1.0555570233019602,0.9292893218813453 1.0707106781186548,0.9444429766980398 1.0831469612302547,0.961731656763491 1.0923879532511287,0.9804909677983872 1.0980785280403231,1 1.1,1.0195090322016127 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302547,1.0707106781186546 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.0382683432365092,1.0980785280403231 1.019509032201613,1.1 1,1.0717462120245884 0.06467514421272098,0.9353248557872769 -0.07174621202458649,0 -0.1,-0.019509032201612955 -0.09807852804032302,-0.03826834323650912 -0.09238795325112863,-0.055557023301960363 -0.08314696123025443,-0.07071067811865482 -0.07071067811865468,-0.08314696123025457 -0.055557023301960155,-0.0923879532511287 -0.03826834323650893,-0.09807852804032306 -0.01950903220161279,-0.1 0.000000000000000012246467991473533,-0.09807852804032305 0.01950903220161282,-0.0923879532511287 0.03826834323650895,-0.08314696123025456 0.055557023301960176,-0.07071067811865482 0.0707106781186547,-0.05555702330196031 0.08314696123025447,-0.0382683432365091 0.09238795325112864,-0.019509032201612972 0.09807852804032302,0 0.1,0.9 0.1))",
},
{
"LINESTRING(0 0,1 0,1 1)", 0.1, []BufferOption{BufferJoinStyleBevel()},
"LINESTRING(0 0,1 0,1 1)", 0.1,
[]BufferOption{BufferJoinStyleBevel()},
"POLYGON((0.9 0.1,0.9 1,0.901921471959677 1.019509032201613,0.9076120467488714 1.0382683432365092,0.9168530387697456 1.0555570233019602,0.9292893218813453 1.0707106781186548,0.9444429766980398 1.0831469612302547,0.961731656763491 1.0923879532511287,0.9804909677983872 1.0980785280403231,1 1.1,1.0195090322016127 1.0980785280403231,1.038268343236509 1.0923879532511287,1.0555570233019602 1.0831469612302547,1.0707106781186546 1.0707106781186548,1.0831469612302544 1.0555570233019602,1.0923879532511287 1.0382683432365092,1.0980785280403231 1.019509032201613,1.1 1,1.1 0,1 -0.1,0 -0.1,-0.019509032201612955 -0.09807852804032302,-0.03826834323650912 -0.09238795325112863,-0.055557023301960363 -0.08314696123025443,-0.07071067811865482 -0.07071067811865468,-0.08314696123025457 -0.055557023301960155,-0.0923879532511287 -0.03826834323650893,-0.09807852804032306 -0.01950903220161279,-0.1 0.000000000000000012246467991473533,-0.09807852804032305 0.01950903220161282,-0.0923879532511287 0.03826834323650895,-0.08314696123025456 0.055557023301960176,-0.07071067811865482 0.0707106781186547,-0.05555702330196031 0.08314696123025447,-0.0382683432365091 0.09238795325112864,-0.019509032201612972 0.09807852804032302,0 0.1,0.9 0.1))",
},
} {
Expand Down
2 changes: 0 additions & 2 deletions internal/cmprefimpl/cmppg/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func checkWKTParse(t *testing.T, pg PostGIS, candidates []string) {
for i, wkt := range candidates {
any = true
t.Run(fmt.Sprintf("CheckWKTParse_%d", i), func(t *testing.T) {

// The simple feature library accepts LINEARRING WKTs. However,
// postgis doesn't accept them. A workaround for this is to just
// substitute LINEARRING for LINESTRING. However, this will give a
Expand Down Expand Up @@ -501,7 +500,6 @@ func containsOnlyPolygonsOrMultiPolygons(g geom.Geometry) bool {

func checkForceCoordinatesDimension(t *testing.T, want UnaryResult, g geom.Geometry) {
t.Run("CheckForceCoordinatesDimension", func(t *testing.T) {

// In the case where a collection has some elements but they are all
// empty, PostGIS is giving back a collection with zero elements rather
// than transforming each empty elements' coordinates type. So we skip
Expand Down
1 change: 0 additions & 1 deletion internal/cmprefimpl/cmppg/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestFuzz(t *testing.T) {
}
for i, g := range geoms {
t.Run(fmt.Sprintf("geom_%d_", i), func(t *testing.T) {

// This geometry shows a problem with the simplefeature's convex hull.
// See https://github.com/peterstace/simplefeatures/issues/246
if g.AsText() == "LINESTRING(1 0,0.5000000000000001 0.5,0 1)" {
Expand Down
4 changes: 1 addition & 3 deletions rtree/bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package rtree

import (
"fmt"
"math/rand"
"strconv"
"testing"

"math/rand"
)

func TestQuickPartition(t *testing.T) {
Expand Down Expand Up @@ -46,7 +45,6 @@ func TestQuickPartition(t *testing.T) {
t.Run(strconv.Itoa(i), func(t *testing.T) {
for k := range tc {
t.Run(fmt.Sprintf("k=%d", k), func(t *testing.T) {

items := make([]BulkItem, 0, len(tc))
for _, num := range tc {
f := float64(num)
Expand Down
1 change: 0 additions & 1 deletion rtree/perf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func BenchmarkDelete(b *testing.B) {
// limiting the total runtime of the entire benchmark).
for pop := 100; pop <= 10000; pop *= 10 {
b.Run(fmt.Sprintf("n=%d", pop), func(b *testing.B) {

var boxes []Box
trees := make([]*RTree, b.N)
for i := 0; i < b.N; i++ {
Expand Down
2 changes: 1 addition & 1 deletion rtree/rtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (n *node) appendChild(box Box, child *node) {

// depth calculates the number of layers of nodes in the subtree rooted at the node.
func (n *node) depth() int {
var d = 1
d := 1
for !n.isLeaf {
d++
n = n.entries[0].child
Expand Down

0 comments on commit 62ebc9e

Please sign in to comment.