Skip to content

Commit 9e5f41a

Browse files
committed
Added coverage command to MakeFile. Updated test & lint commands
Fixed Lint Command Changed golangci-lint install method Updated get lint method Updated Lint Version Updated Gocache folder Added HOME var to makefile for temp dir Added GitHub username to the maintainers list in OWNERS File move interns to reviewers move interns to reviewers section Make File Updated with test & coverage Removed intern names from OWNERS File
1 parent e7d41ae commit 9e5f41a

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ GOOS?=linux
44
GOARCH?=amd64
55
GOENV=GOOS=${GOOS} GOARCH=${GOARCH} CGO_ENABLED=0 GOFLAGS=
66
GOPATH := $(shell go env GOPATH)
7+
HOME=$(shell mktemp -d)
8+
GOLANGCI_LINT_VERSION=v1.51.2
79

810
# Ensure go modules are enabled:
911
export GO111MODULE=on
@@ -34,10 +36,28 @@ tools:
3436
test:
3537
go test ./... -covermode=atomic -coverpkg=./... -v
3638

39+
test-cover:
40+
go test -covermode=atomic -coverpkg=./... -coverprofile=coverage.out ./...
41+
42+
.PHONY: coverage-html
43+
cover-html:
44+
go tool cover -html=coverage.out
45+
46+
.PHONY:coverage
47+
coverage:test-cover
48+
@{ \
49+
set -e ;\
50+
REQ_COV=15.5 ;\
51+
TEST_COV=$$(go tool cover -func coverage.out | grep -F total | awk '{print substr($$3, 1, length($$3)-1)}' ) ;\
52+
if (( $$(echo "$$REQ_COV > $$TEST_COV" |bc -l) )); then echo "Error: Code Coverage is less"; exit 1 ;\
53+
else echo "Code Coverage Test Passed"; exit 0; fi ;\
54+
}
55+
@rm -rf coverage.out
56+
3757
# Installed using instructions from: https://golangci-lint.run/usage/install/#linux-and-windows
3858
getlint:
3959
@mkdir -p $(GOPATH)/bin
40-
@ls $(GOPATH)/bin/golangci-lint 1>/dev/null || (echo "Installing golangci-lint..." && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.42.0)
60+
@ls $(GOPATH)/bin/golangci-lint 1>/dev/null || (echo "Installing golangci-lint..." && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION))
4161

4262
.PHONY: lint
4363
lint: getlint

OWNERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,3 @@ maintainers:
1010
- supreeth7
1111
- MitaliBhalla
1212
- T0MASD
13-
- Deepanshu276
14-
- Dee-6777

0 commit comments

Comments
 (0)