Skip to content

Commit 065780e

Browse files
authored
Merge pull request #5 from smira/update-build
Modernize build: bump Go version, golangci-lint, fix lint errors...
2 parents 202d2d1 + 37a8a2d commit 065780e

10 files changed

+55
-18
lines changed

.golangci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
linters:
2+
enable:
3+
- gofmt
4+
- gosec
5+
- unconvert
6+
- misspell
7+
- goimports
8+
- megacheck
9+
- staticcheck
10+
- unused
11+
- deadcode
12+
- typecheck
13+
- ineffassign
14+
- golint
15+
- stylecheck
16+
- unparam

.travis.yml

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
dist: trusty
1+
dist: xenial
22
sudo: false
33

44
language: go
55

66
go:
7-
- 1.9.x
8-
- 1.10.x
7+
- 1.11.x
8+
- 1.12.x
99
- master
1010

11+
env:
12+
- GO111MODULE=on
13+
14+
before_install:
15+
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0
16+
1117
matrix:
1218
allow_failures:
1319
- go: master

Makefile

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
all: test check bench
22

3-
deps:
4-
go get -v -d -t ./...
5-
go get -v github.com/alecthomas/gometalinter
6-
gometalinter --install
7-
8-
test: deps
3+
test:
94
go test -race -v -coverprofile=coverage.txt -covermode=atomic
105

11-
bench: deps
6+
bench:
127
go test -v -run ^Test$$ -bench=. ./... -gocheck.b
138

149
check:
15-
go test -i
16-
gometalinter --vendored-linters --deadline=30s --cyclo-over=16 ./...
10+
golangci-lint run
1711

18-
.PHONY: deps test bench check
12+
.PHONY: test bench check

dbscan.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type EpsFunction func(pt Point) float64
3737
// DBScan clusters incoming points into clusters with params (eps, minPoints)
3838
//
3939
// eps is clustering radius in km
40-
// minPoints in minumum number of points in eps-neighbourhood (density)
40+
// minPoints in minimum number of points in eps-neighbourhood (density)
4141
func DBScan(points PointList, eps float64, minPoints int) (clusters []Cluster, noise []int) {
4242
visited := make([]bool, len(points))
4343
members := make([]bool, len(points))

dbscan_test.go

+2-1
Large diffs are not rendered by default.

distance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
const (
8-
// DegreeRad is coefficent to translate from degrees to radians
8+
// DegreeRad is coefficient to translate from degrees to radians
99
DegreeRad = math.Pi / 180.0
1010
// EarthR is earth radius in km
1111
EarthR = 6371.0

distance_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package cluster
22

33
import (
4-
. "gopkg.in/check.v1"
54
"math"
5+
6+
. "gopkg.in/check.v1"
67
)
78

89
type DistanceSuite struct {

go.mod

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/smira/go-point-clustering
2+
3+
go 1.12
4+
5+
require (
6+
github.com/kr/pretty v0.1.0 // indirect
7+
github.com/willf/bitset v1.1.10
8+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
9+
)

go.sum

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
2+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
3+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
4+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
5+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
6+
github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
7+
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
8+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
9+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

point_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package cluster
22

33
import (
4-
. "gopkg.in/check.v1"
54
"testing"
5+
6+
. "gopkg.in/check.v1"
67
)
78

89
// Launch gocheck tests

0 commit comments

Comments
 (0)