sonar-golang
sonar-golang copied to clipboard
ERROR: Error parsing coverage info for file coverage.xml: Invalid go coverage, expect 'mode:' on the first line.
Description
ERROR: Error parsing coverage info for file coverage.xml: Invalid go coverage, expect 'mode:' on the first line
Steps to Reproduce
1. go get github.com/axw/gocov/gocov;
2. go get github.com/AlekSi/gocov-xml;
3. go test -coverpkg="./controllers" -coverprofile=cover.out;
4. gocov convert cover.out | gocov-xml > coverage.xml;
Content of your sonar-project.properties
sonar.sources=./
sonar.exclusions=cathay_cc_test.go,libraries/**/*
export SONAR_SCANNER_OPTS="-Xmx1024m"
sonar.sourceEncoding=UTF-8
sonar.go.coverage.reportPaths=coverage.xml
It will help us to check how you configured the plugin.
Log of sonar-scanner related to the plugin
Could you solve it? I am facing the same issue
I got rid of the error by sending the cover.out file.
@juliorenner the docs say you have to use xml format:
For coverage metrics you must have one or multiple coverage.xml (cobertura xml format) files.
The .out file generated by go tool cover is not xml. For instance:
go tool cover -func cover.out -o /go/src/foo/bar/coverage/api.cov generates:
foo/bar/api/dao/dao.go:46: AccountExist 85.7%
[etc]