Skip to content

Commit 0d77b22

Browse files
rghetiaPaulo Janotti
authored and
Paulo Janotti
committed
Fix build for go 1.13 (#65)
1 parent e747a7e commit 0d77b22

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ local/
22

33
# GoLand IDEA
44
/.idea/
5+
*.iml
56

67
# VS Code
78
.vscode

Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ test-with-cover:
2929
@echo Verifying that all packages have test files to count in coverage
3030
@scripts/check-test-files.sh $(subst github.com/open-telemetry/opentelemetry-collector-contrib/,./,$(ALL_PKGS))
3131
@echo pre-compiling tests
32-
go test -i $(ALL_PKGS)
33-
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS)
34-
go tool cover -html=coverage.txt -o coverage.html
32+
set -e; for dir in $(ALL_TEST_DIRS); do \
33+
echo "go test ./... + coverage in $${dir}"; \
34+
(cd "$${dir}" && \
35+
$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./... && \
36+
go tool cover -html=coverage.txt -o coverage.html ); \
37+
done
3538

3639
.PHONY: install-tools
3740
install-tools:

Makefile.Common

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ ALL_SRC_AND_DOC := $(shell find . \( -name "*.md" -o -name "*.go" -o -name "*.ya
77

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

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

3638
.PHONY: test
3739
test:
38-
$(GOTEST) $(GOTEST_OPT) $(ALL_PKGS)
40+
# $(GOTEST) $(GOTEST_OPT) $(ALL_TEST_DIRS)
41+
set -e; for dir in $(ALL_TEST_DIRS); do \
42+
echo "go test ./... in $${dir}"; \
43+
(cd "$${dir}" && \
44+
$(GOTEST) ./... ); \
45+
done
3946

4047
.PHONY: benchmark
4148
benchmark:

0 commit comments

Comments
 (0)