Reports not read during Go analysis

We are using the Sonar PR Scanner on branch builds within our Jenkin’s setup, but with certain Go-Lang based repositories, we are not getting any scan results to be reported.

I have mirrored my project’s scanner configuration after a coworkers other go-lang project similar to ours configurations. The errors that have been giving me issue are the following:

  • ERROR: Coverage report can’t be loaded, report file not found, ignoring this file reports/coverage.out.

  • ERROR: GoMetaLinterReportSensor: No issues information will be saved as the report file ‘/home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/master/reports/lint.txt’ can’t be read.

  • WARN: GoMetaLinterReportSensor: No input file found for src/controllers/runController_test.go. No GoMetaLinter issues will be imported on this file. java.nio.file.NoSuchFileException: /home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/master/reports/lint.txt

I have been thinking it has to do with the location of the reports files, but my attempts to fix this issue have not been successful.

Below are some points of info I think should give more context:

sonar.coverage.exclusions=** / * .json, ** / * .js,** / * .xml

Report Generation Scripts:

…to generate the report directory…

rm -rf “$reportDir”
mkdir -p “$reportDir”

…later followed by…

junitReport=“go-junit-report > $reportDir/report.xml”
goCov=“gocov convert $reportDir/coverage.out”
goCovXml=“gocov-xml > $reportDir/coverage.xml”
goHtml=“go tool cover -html=$reportDir/coverage.out -o $reportDir/coverage.html”
chmodVol=“chmod -R a+rwx $reportDir”
genReports=“cat $reportDir/report.txt | $junitReport && $goCov | $goCovXml && $goHtml && $chmodVol”

We then later run genReports after we run our unit tests.


Your title doesn’t seem to match the post. Is the problem that you don’t have write permissions on the directory after analysis, or that coverage isn’t being picked up by analysis?


Hi Ann,

I do not know if it is either of those scenarios. All I know is I do not see coverage metrics being reported, followed by the error messages I see in the console output, listed in the original post.

I have not fully considered the lack of permissions to maybe write to those files - I will investigate this today. That seems plausible, since it seems the files for the reports are found, just ignored for whatever reason.

I also have attached the reports folder containing the files used, in case that is of any help.

reports (3).zip (945.0 KB)


I’ve updated the title.

At this point, it would be helpful to have your analysis log. E.G. the log from the Jenkins job.


Thank you for updating! Upload of the analysis log here

compliance_branchScan.txt (93.6 KB)


Thanks for your log. Your original report was this:

For GoLint, I’m not sure what’s going on, but for GoMetaLinter, I find this in your log:

WARN [runner] Can't run linter goanalysis_metalinter: S1036: failed prerequisites: [inspect@_/home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/branch/src/adapter: analysis skipped: errors in package: [/home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/branch/src/adapter/S3Adapter.go:16:2: could not import (src/adapter/S3Adapter.go:16:2: cannot find package "" in any of:...

For coverage, I don’t see that error in this log, so I guess the problem got taken care of…?

Anyway, all 3 of the errors in your OP relate to not being able to read the reports in question. From what I’m seeing in the log, it’s a question of the reports not existing. So you need to look to the step(s) before SonarQube analysis and make sure those reports get generated.


compliance_branchScan (3).txt (284.5 KB)

Thank you and sorry for the delayed response! I got rid of that error after updating the gometalinter version.

I am still seeing the errors from my OP, though. Still at a loss as to why the reports cannot be written to. The reports are being generated in our branch build location: /home/jenkins/workspace/aqa/integration/sonar-pr-scans/go/branch/reports ,
such that it generates the reports in our sonar-pr-scans file location, where we break down the reports based upon language and branch branch. I got and verified the location with an echo of “reportDir” - the variable used in the generation scripts to define our reports directory location.

I have also set the file to have the full path for our coverage file within that directory, as you can see in my earlier post stating the properties used. I know that may be overkill, but the branch build shows no differences when I have set it to reports/coverage.out, and I wanted to verify that for my own sake.

I’ve attached my updated logs where you will no longer find the gometalinter from earlier.


In your updated log, I don’t see anything about not being able to write the reports, only that they can’t be read because they don’t seem to exist. Can you pull out for me the lines from this log that show the report(s) being generated? Because it’s not clear to me that they are.


Hi Ann,

Thank you for pointing that out - I was misinterpreting the logs. You are right, it seems statements in the logs point more to a lack of these files.

Currently, the script running our unit tests has a variable containing the command for report generation.

genReports="cat $reportDir/report.txt | $junitReport && $goCov | $goCovXml && $goHtml && $chmodVol"

Which, the other variables used to store commands are as follows:

`junitReport="go-junit-report > $reportDir/report.xml"`
`goCov="gocov convert $reportDir/coverage.out"`
`goCovXml="gocov-xml > $reportDir/coverage.xml"`
`goHtml="go tool cover -html=$reportDir/coverage.out -o $reportDir/coverage.html"`

This report generation commands are called after we get some utils to install before running the tests, then we install and run our linter, and then run our unit tests. Listed here is our “Order of Operations” :

  1. get utils (goverage, go-junit-report, gocov, gocov-xml, gometalinter

  2. install our linter (command: “gometalinter.v1 --install”)

  3. run our linter (command: “gometalinter.v1 $src/… > $reportDir/lint.txt || true”)

  4. run our unit tests (command: “goverage -v -coverprofile=$reportDir/coverage.out $goComplianceCodePath/src/… > $reportDir/report.txt || true”)

  5. Finally, we generate reports, as seen in the commands above

Could it possibly be, that our reports are generated too late in the process? I am now questioning why the command for report generation happens after unit tests are run…


TBH, I have no experience of this with Go. I’ve only ever done it with Java/Maven by copying a command someone else wrote.


Ahh, dang. Well - I can only confirm that the files for reports are being generated where I expect them to be, but I am still very unsure why the report files are unable to be found and/or read?

What you didn’t list in your order of operations (^) was when SonarQube analysis kicks in…