[Go] Line coverage still showing uncovered

Template for a good new topic, formatted with Markdown:

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: Go
  • Error observed: None
  • Steps to reproduce: None
  • Potential workaround
    • Asking AI it might be solved to convert the coverage.out to cobertura XML format to avoid column coverage. So only rely on line coverage

Problem:

Observed that the line of code that supposed to be covered by unit test but still showing not covered in the SonarQube Cloud UI.

Below is the Screenshot of coverage status and reference snapshot from coverage.out file

Hi,

For coverage, we go 100% by what’s in the report, so if it’s not showing up as covered in SonarQube, then I would question what’s in your report. Generally, we would not see function declarations or the closing } as executable and therefore not capable of being uncovered.

I think this is a question for the maintainers of your coverage engine.

 
Ann