Skip to content

Commit

Permalink
Fix build for go 1.13 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
rghetia authored and Paulo Janotti committed Dec 13, 2019
1 parent e747a7e commit 0d77b22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local/

# GoLand IDEA
/.idea/
*.iml

# VS Code
.vscode
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ test-with-cover:
@echo Verifying that all packages have test files to count in coverage
@scripts/check-test-files.sh $(subst github.com/open-telemetry/opentelemetry-collector-contrib/,./,$(ALL_PKGS))
@echo pre-compiling tests
go test -i $(ALL_PKGS)
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS)
go tool cover -html=coverage.txt -o coverage.html
set -e; for dir in $(ALL_TEST_DIRS); do \
echo "go test ./... + coverage in $${dir}"; \
(cd "$${dir}" && \
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./... && \
go tool cover -html=coverage.txt -o coverage.html ); \
done

.PHONY: install-tools
install-tools:
Expand Down
9 changes: 8 additions & 1 deletion Makefile.Common
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ALL_SRC_AND_DOC := $(shell find . \( -name "*.md" -o -name "*.go" -o -name "*.ya

# ALL_PKGS is used with 'go cover'
ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))
# ALL_TEST_DIRS includes ./* dirs (excludes . dir)
ALL_TEST_DIRS := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./' )

GOTEST_OPT?= -race -timeout 30s
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic
Expand Down Expand Up @@ -35,7 +37,12 @@ common: addlicense fmt impi vet lint goimports misspell staticcheck test

.PHONY: test
test:
$(GOTEST) $(GOTEST_OPT) $(ALL_PKGS)
# $(GOTEST) $(GOTEST_OPT) $(ALL_TEST_DIRS)
set -e; for dir in $(ALL_TEST_DIRS); do \
echo "go test ./... in $${dir}"; \
(cd "$${dir}" && \
$(GOTEST) ./... ); \
done

.PHONY: benchmark
benchmark:
Expand Down

0 comments on commit 0d77b22

Please sign in to comment.