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

Fix lint and coverage #202

Merged
merged 3 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should go to user's global gitignore


# 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 ./...