Skip to content

Commit d4f0335

Browse files
committed
ci: fix go 1.12 build error due to coverpkg
Go 1.12 can't handle multiple mains in coverpkg. As workaround we exclude the examples in coverpkg for the 1.12 build.
1 parent 2880bd7 commit d4f0335

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ script:
5252
- go test -v -race -run "$race_tests" -timeout 15m
5353

5454
# We run all tests again to get full coverage, technically unncecessary tho
55-
- go test -v -timeout 30m -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v msg | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/') ./...
55+
- coverpkg_ignore='/msg'
56+
# coverpkg for multiple mains is broken in 1.12, so we need to exclude the examples from coverage
57+
# https://github.com/golang/go/issues/30374
58+
- if ! [[ "$TRAVIS_GO_VERSION" =~ ^1\.11 ]]; then coverpkg_ignore="${coverpkg_ignore}|/examples"; fi
59+
- go test -v -timeout 30m -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v -E ${coverpkg_ignore} | awk -vORS=, '{ print $1 }' | sed 's/,$/\n/') ./...
5660

5761
after_success:
5862
- bash <(curl -s https://codecov.io/bash)

0 commit comments

Comments
 (0)