Sonar Coverage showing 0% for Go Langugae

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi,

Sonarqube version : 8.9.6
Facing issue with coverage it is showing 0 % for go language.

Please find sonar properties file :

sonar.projectKey = coreload-snomed-service
sonar.projectName = snomed-service
sonar.sources = ./source
sonar.sourceEncoding = UTF-8
sonar.language = go
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
sonar.go.coverage.reportPaths = .gogradle/reports/coverage/profiles/*.out
sonar.exclusions = component-test/,deployment-files/,deploy.yml,client/,test/,parser/,dicom_part_16_xml/
sonar.java.binaries = snomed-service/build/classes/
sonar.java.libraries = build/libs/

Thanks,
Lavanya

What do the scanner logs say? Look for logs around here:

INFO: Sensor Go Cover sensor for Go coverage [go]

Hi Colin,

Yes, It is says INFO: Sensor Go Cover sensor for Go coverage [go]

Please find the sonar logs attached.

Thanks,
Lavanya
sonar logs.txt (104.7 KB)

It looks like a coverage report is successfully being read.

[2022-07-01T06:06:10.920Z] INFO: Sensor Go Cover sensor for Go coverage [go]
[2022-07-01T06:06:10.920Z] INFO: Load coverage report from '/dockerspace/coreload-5.x/workspace/Coreload-5x/5x_GO/snomed-service/.gogradle/reports/coverage/profiles/snomed-service%2Ftest.out'
[2022-07-01T06:06:10.920Z] WARN: File 'snomed-service/test/annexcustomsctmeaning.go' is not included in the project, ignoring coverage
[2022-07-01T06:06:10.920Z] WARN: File 'snomed-service/test/test_util.go' is not included in the project, ignoring coverage
[2022-07-01T06:06:10.920Z] INFO: Sensor Go Cover sensor for Go coverage [go] (done) | time=21ms

Are there specific files/lines you expect to see coverage reported for and isn’t? If you manually review /dockerspace/coreload-5.x/workspace/Coreload-5x/5x_GO/snomed-service/.gogradle/reports/coverage/profiles/snomed-service%2Ftest.out, do you find coverage for those files/lines?

Hi Colin,

In sonar dashboard it is showing 0%.

Hi Colin,

/dockerspace/coreload-5.x/workspace/Coreload-5x/5x_GO/snomed-service/.gogradle/reports/coverage/profiles/snomed-service%2Ftest.out we can able to see the coverage.

Thanks,
Lavanya