Golangci-lint integration error

  • versions used (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Version 7.2.1 (build 14109)
    Sonargo - 1.6
    https://docs.sonarqube.org/latest/analysis/languages/go/
    1.6
    2019-08-06
    7.9+ (Compatible with LTS)

  • error observed (wrap logs/code around triple quote ``` for proper formatting)

I was trying to integrate with golangci-lint with Sonar as described below

SonarGo is now able to import external issues from golangci-lint …
generate the report in checkstyle format:
golangci-lint run --out-format checkstyle > report.xml
import this report by using the sonar.go.golangci-lint.reportPaths property.

  • steps to reproduce

golangci-lint run --out-format checkstyle >> report.xml

Got this stack while Sonar was trying to import

INFO: Quality profile for go: Sonar way

INFO: Sensor SonarGo [go]

INFO: 1 source files to be analyzed

INFO: Sensor SonarGo [go] (done) | time=233ms

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

INFO: Load coverage report from '/var/lib/jenkins-slave/workspace/DAaaS-k8s-CI-mergereq2master/sampleGoMs/aa_sample_service_go/cover.out'

INFO: 1/1 source files have been analyzed

INFO: Sensor Go Cover sensor for Go coverage [go] (done) | time=30ms

INFO: Sensor Import of GolangCI-Lint issues [go]

INFO: Importing /var/lib/jenkins-slave/workspace/DAaaS-k8s-CI-mergereq2master/sampleGoMs/aa_sample_service_go/report.xml

ERROR: No issue information will be saved as the report file '/var/lib/jenkins-slave/workspace/DAaaS-k8s-CI-mergereq2master/sampleGoMs/aa_sample_service_go/report.xml' can't be read.

com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog

 at [row,col {unknown-source}]: [1,0]

	at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:685)

	at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2141)

	at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)

	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1131)

	at org.codehaus.stax2.ri.Stax2EventReaderImpl.nextEvent(Stax2EventReaderImpl.java:255)

	at org.sonarsource.slang.externalreport.CheckstyleFormatImporter.importFile(CheckstyleFormatImporter.java:91)

	at java.util.ArrayList.forEach(ArrayList.java:1257)

	at org.sonar.go.externalreport.GolangCILintReportSensor.execute(GolangCILintReportSensor.java:49)

	at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)

	at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)

	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)

	at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)

	at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)

	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)

	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)

	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)

	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:312)

	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:307)

	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:281)

	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)

	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)

	at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)

	at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:81)

	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)

	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)

	at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:132)

	at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)

	at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)

	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.lang.reflect.Method.invoke(Method.java:498)

	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

	at com.sun.proxy.$Proxy0.execute(Unknown Source)

	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)

	at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)

	at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)

	at org.sonarsource.scanner.cli.Main.execute(Main.java:77)

	at org.sonarsource.scanner.cli.Main.main(Main.java:61)



INFO: Sensor Import of GolangCI-Lint issues [go] (done) | time=5ms

the xml file was empty ; as I was building in CI inside docker