Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage is not working if os module is used in test #3819

Closed
supercairos opened this issue Jan 8, 2024 · 3 comments · Fixed by #3820
Closed

Coverage is not working if os module is used in test #3819

supercairos opened this issue Jan 8, 2024 · 3 comments · Fixed by #3820

Comments

@supercairos
Copy link

While running coverage on a pkg that use the os module, coverage is not outputed.

What version of rules_go are you using?

0.44.2

What version of gazelle are you using?

0.35.0

What version of Bazel are you using?

7.0.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Darwin / arm64

What did you do?

Please see this repository for reproduction:
https://github.com/supercairos/bazelgoperfectcoverage

running
bazel coverage //... don't produce any coverage.

What did you expect to see?

Some coverage produced

What did you see instead?

No coverage produced

@fleblay
Copy link

fleblay commented Jan 9, 2024

Same problem here. Would be interested in a fix as well !

@fmeum
Copy link
Member

fmeum commented Jan 9, 2024

The root cause isn't the import of os, it's specifically the call to os.Clearenv that results in rules_go's coverage handler writing the coverage file into the wrong location. I have a fix out at #3820.

@supercairos
Copy link
Author

Thank you for your prompt fix!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants