Skip to content

Commit

Permalink
Merge pull request #5 from smira/update-build
Browse files Browse the repository at this point in the history
Modernize build: bump Go version, golangci-lint, fix lint errors...
  • Loading branch information
smira authored May 15, 2019
2 parents 202d2d1 + 37a8a2d commit 065780e
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 18 deletions.
16 changes: 16 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
linters:
enable:
- gofmt
- gosec
- unconvert
- misspell
- goimports
- megacheck
- staticcheck
- unused
- deadcode
- typecheck
- ineffassign
- golint
- stylecheck
- unparam
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
dist: trusty
dist: xenial
sudo: false

language: go

go:
- 1.9.x
- 1.10.x
- 1.11.x
- 1.12.x
- master

env:
- GO111MODULE=on

before_install:
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.16.0

matrix:
allow_failures:
- go: master
Expand Down
14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
all: test check bench

deps:
go get -v -d -t ./...
go get -v github.com/alecthomas/gometalinter
gometalinter --install

test: deps
test:
go test -race -v -coverprofile=coverage.txt -covermode=atomic

bench: deps
bench:
go test -v -run ^Test$$ -bench=. ./... -gocheck.b

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

.PHONY: deps test bench check
.PHONY: test bench check
2 changes: 1 addition & 1 deletion dbscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type EpsFunction func(pt Point) float64
// DBScan clusters incoming points into clusters with params (eps, minPoints)
//
// eps is clustering radius in km
// minPoints in minumum number of points in eps-neighbourhood (density)
// minPoints in minimum number of points in eps-neighbourhood (density)
func DBScan(points PointList, eps float64, minPoints int) (clusters []Cluster, noise []int) {
visited := make([]bool, len(points))
members := make([]bool, len(points))
Expand Down
3 changes: 2 additions & 1 deletion dbscan_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion distance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

const (
// DegreeRad is coefficent to translate from degrees to radians
// DegreeRad is coefficient to translate from degrees to radians
DegreeRad = math.Pi / 180.0
// EarthR is earth radius in km
EarthR = 6371.0
Expand Down
3 changes: 2 additions & 1 deletion distance_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cluster

import (
. "gopkg.in/check.v1"
"math"

. "gopkg.in/check.v1"
)

type DistanceSuite struct {
Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module github.com/smira/go-point-clustering

go 1.12

require (
github.com/kr/pretty v0.1.0 // indirect
github.com/willf/bitset v1.1.10
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
)
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3 changes: 2 additions & 1 deletion point_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package cluster

import (
. "gopkg.in/check.v1"
"testing"

. "gopkg.in/check.v1"
)

// Launch gocheck tests
Expand Down

0 comments on commit 065780e

Please sign in to comment.