Azure / azure-sdk-for-go

This repository is for active development of the Azure SDK for Go. For consumers of the SDK we recommend visiting our public developer docs at:
https://docs.microsoft.com/azure/developer/go/
MIT License
1.65k stars 844 forks source link

Can we improve code coverage reporting in CI #23650

Open jhendrixMSFT opened 1 month ago

jhendrixMSFT commented 1 month ago

Changes in code coverage reporting in the latest two versions of Go impact total percentages. It's likely related to our usage of ./... which causes all packages to be included. While this is useful for ensuring that all tests are executed, it has a direct impact on how CC numbers are generated.

For example, consider azcore/internal/exported.HasStatusCode. This is exported in azcore/runtime and there's a test for it there. However, since we use ./... both versions are included in CC numbers which means we need to have a test in both packages (i.e. redundant tests) else we'll get a zero for the internal version, dragging down CC numbers.

I believe we can fix this with the -coverpkg flag however it's not clear what that looks like yet.

jhendrixMSFT commented 1 month ago

See https://github.com/golang/go/issues/68627 which links various issues.