Skip to content

Commit

Permalink
Merge pull request #17 from smira/linters
Browse files Browse the repository at this point in the history
Use golangci-lint, update go versions in the test matrix
  • Loading branch information
smira authored May 15, 2019
2 parents 62ddc7a + 5f2cdc6 commit 76dd963
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
linters:
enable:
- gofmt
- gosec
- unconvert
- misspell
- goimports
- megacheck
- staticcheck
- unused
- deadcode
- typecheck
- ineffassign
- golint
- stylecheck
- unparam
- nakedret
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
dist: trusty
dist: xenial
sudo: false

language: go

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

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
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
all: test check bench

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

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

.PHONY: bench
bench: deps
go test -v -bench . -benchmem -run nothing ./...

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

.PHONY: deps bench test check
4 changes: 2 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (c *Client) GetLostPackets() int64 {
//
// Often used to note a particular event, for example incoming web request.
func (c *Client) Incr(stat string, count int64, tags ...Tag) {
if 0 != count {
if count != 0 {
c.trans.bufLock.Lock()
lastLen := len(c.trans.buf)

Expand Down Expand Up @@ -185,7 +185,7 @@ func (c *Client) Decr(stat string, count int64, tags ...Tag) {

// FIncr increments a float counter metric
func (c *Client) FIncr(stat string, count float64, tags ...Tag) {
if 0 != count {
if count != 0 {
c.trans.bufLock.Lock()
lastLen := len(c.trans.buf)

Expand Down
2 changes: 1 addition & 1 deletion statsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ For every metric sent, tags could be added as the last argument(s) to the functi
call:
client.Incr("request", 1,
statsd.StringTag("procotol", "http"), statsd.IntTag("port", 80))
statsd.StringTag("protocol", "http"), statsd.IntTag("port", 80))
*/
package statsd

Expand Down

0 comments on commit 76dd963

Please sign in to comment.