Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Fix lint and coverage (#202)
Browse files Browse the repository at this point in the history
* Fix lint and coverage

Signed-off-by: Yuri Shkuro <[email protected]>

* Use separate target for cover as older Go versions cannot do multi-package coverage

Signed-off-by: Yuri Shkuro <[email protected]>

* fix makefile

Signed-off-by: Yuri Shkuro <[email protected]>
  • Loading branch information
yurishkuro authored Nov 29, 2018
1 parent 6b6f234 commit f6bb0d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 35 deletions.
14 changes: 1 addition & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
# IntelliJ project files
.idea/
opentracing-go.iml
opentracing-go.ipr
opentracing-go.iws

# Test results
*.cov
*.html
test.log

# Build dir
build/
coverage.txt
21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
language: go

go:
- 1.7.x
- 1.8.x
- 1.9.x
- tip
matrix:
include:
- go: "1.7.x"
- go: "1.8.x"
- go: "1.9.x"
- go: "tip"
env:
- LINT=true
- COVERAGE=true

install:
- go get -u golang.org/x/lint/golint/...
- if [ "$LINT" == true ]; then go get -u golang.org/x/lint/golint/... ; else echo 'skipping lint'; fi
- go get -u github.com/stretchr/testify/...
- go get -u golang.org/x/net/context

script:
- make test lint
- make test
- go build ./...
- if [ "$LINT" == true ]; then make lint ; else echo 'skipping lint'; fi
- if [ "$COVERAGE" == true ]; then make cover && bash <(curl -s https://codecov.io/bash) ; else echo 'skipping coverage'; fi
18 changes: 3 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
PACKAGES := . ./mocktracer/... ./ext/...

.DEFAULT_GOAL := test-and-lint

.PHONE: test-and-lint

.PHONY: test-and-lint
test-and-lint: test lint

.PHONY: test
test:
go test -v -cover -race ./...

.PHONY: cover
cover:
@rm -rf cover-all.out
$(foreach pkg, $(PACKAGES), $(MAKE) cover-pkg PKG=$(pkg) || true;)
@grep mode: cover.out > coverage.out
@cat cover-all.out >> coverage.out
go tool cover -html=coverage.out -o cover.html
@rm -rf cover.out cover-all.out coverage.out

cover-pkg:
go test -coverprofile cover.out $(PKG)
@grep -v mode: cover.out >> cover-all.out
go test -v -coverprofile=coverage.txt -covermode=atomic -race ./...

.PHONY: lint
lint:
Expand All @@ -29,4 +18,3 @@ lint:
@# Run again with magic to exit non-zero if golint outputs anything.
@! (golint ./... | read dummy)
go vet ./...

0 comments on commit f6bb0d0

Please sign in to comment.