Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Error parsing coverage info for file coverage.xml: Invalid go coverage, expect 'mode:' on the first line. #77

Open
hieu29791 opened this issue Aug 2, 2019 · 3 comments

Comments

@hieu29791
Copy link

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

sonarqube

@juliorenner
Copy link

Could you solve it? I am facing the same issue

@juliorenner
Copy link

I got rid of the error by sending the cover.out file.

@jcollum
Copy link

jcollum commented Mar 26, 2020

@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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants