diff --git a/Makefile b/Makefile index b2d40280d..f8b52f6af 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ coredns: check godeps CGO_ENABLED=0 $(SYSTEM) go build -v -ldflags="-s -w -X github.com/coredns/coredns/coremain.gitCommit=$(GITCOMMIT)" -o $(BINARY) .PHONY: check -check: fmt core/zplugin.go core/dnsserver/zdirectives.go godeps +check: linter core/zplugin.go core/dnsserver/zdirectives.go godeps .PHONY: test test: check @@ -62,17 +62,11 @@ core/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg gen: go generate coredns.go -.PHONY: fmt -fmt: - ## run go fmt - @test -z "$$(find . -type d | grep -vE '(/vendor|^\.$$|/.git|/.travis)' | xargs gofmt -s -l | tee /dev/stderr)" || \ - (echo "please format Go code with 'gofmt -s -w'" && false) - -.PHONY: lint -lint: - go get -u github.com/golang/lint/golint - @test -z "$$(find . -type d | grep -vE '(/vendor|^\.$$|/.git|/.travis)' | grep -vE '(^\./pb)' | xargs golint \ - | grep -vE "context\.Context should be the first parameter of a function" | tee /dev/stderr)" +.PHONY: linter +linter: + go get -u github.com/alecthomas/gometalinter + gometalinter --install golint + gometalinter --deadline=1m --disable-all --enable=gofmt --enable=golint --enable=vet --exclude=^vendor/ --exclude=^pb/ ./... .PHONY: clean clean: diff --git a/plugin/plugin.go b/plugin/plugin.go index 0c4d7f604..d6b7c9976 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -69,7 +69,7 @@ func Error(name string, err error) error { return fmt.Errorf("%s/%s: %s", "plugi // NextOrFailure calls next.ServeDNS when next is not nill, otherwise it will return, a ServerFailure // and a nil error. -func NextOrFailure(name string, next Handler, ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { +func NextOrFailure(name string, next Handler, ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) { // nolint: golint if next != nil { if span := ot.SpanFromContext(ctx); span != nil { child := span.Tracer().StartSpan(next.Name(), ot.ChildOf(span.Context())) diff --git a/test/etcd_cache_test.go b/test/etcd_cache_test.go index b14374455..361f4c78a 100644 --- a/test/etcd_cache_test.go +++ b/test/etcd_cache_test.go @@ -68,7 +68,7 @@ func checkResponse(t *testing.T, resp *dns.Msg) { t.Errorf("Expected RR to A, got: %d", resp.Answer[0].Header().Rrtype) } if resp.Answer[0].(*dns.A).A.String() != "127.0.0.1" { - t.Errorf("Expected 127.0.0.1, got: %d", resp.Answer[0].(*dns.A).A.String()) + t.Errorf("Expected 127.0.0.1, got: %s", resp.Answer[0].(*dns.A).A.String()) } } diff --git a/test/reload_test.go b/test/reload_test.go index db24952ca..24941c6d4 100644 --- a/test/reload_test.go +++ b/test/reload_test.go @@ -49,6 +49,6 @@ func send(t *testing.T, server string) { t.Fatalf("Expected successful reply, got %s", dns.RcodeToString[r.Rcode]) } if len(r.Extra) != 2 { - t.Fatalf("Expected 2 RRs in additional, got %s", len(r.Extra)) + t.Fatalf("Expected 2 RRs in additional, got %d", len(r.Extra)) } }