From e7f9606683f82a371ff7add9fe35fbb4548d8b20 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Tue, 2 Feb 2021 18:20:15 +0200 Subject: [PATCH] Add dummy go files for test only package, to mitigate golang/go#27333 (#1480) * Add dummy go files for test only package, to mitigate golang/go#27333 * Stop ignoring errors when producing the coverage * Add comments explaining the dummy go files * Make the coverage output non-json --- .github/workflows/go.yml | 3 +-- app/protocol/flows/testing/testing.go | 4 ++++ testing/integration/integration.go | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 app/protocol/flows/testing/testing.go create mode 100644 testing/integration/integration.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 57398f5b5..9ac54e3ba 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -63,8 +63,7 @@ jobs: go-version: 1.15 - name: Create coverage file - # Because of https://github.com/golang/go/issues/27333 this seem to "fail" even though nothing is wrong, so ignore the failure - run: go test -json -covermode=atomic -coverpkg=./... -coverprofile coverage.txt ./... || true + run: go test -covermode=atomic -coverpkg=./... -coverprofile coverage.txt ./... - name: Upload coverage file run: bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/app/protocol/flows/testing/testing.go b/app/protocol/flows/testing/testing.go new file mode 100644 index 000000000..a31e8c8c9 --- /dev/null +++ b/app/protocol/flows/testing/testing.go @@ -0,0 +1,4 @@ +package testing + +// Because of a bug in Go coverage fails if you have packages with test files only. See https://github.com/golang/go/issues/27333 +// So this is a dummy non-test go file in the package. diff --git a/testing/integration/integration.go b/testing/integration/integration.go new file mode 100644 index 000000000..6524145dc --- /dev/null +++ b/testing/integration/integration.go @@ -0,0 +1,4 @@ +package integration + +// Because of a bug in Go coverage fails if you have packages with test files only. See https://github.com/golang/go/issues/27333 +// So this is a dummy non-test go file in the package.