sonar-golang
sonar-golang copied to clipboard
The coverage of the calculation is wrong!
Description
I have some problems in sonarqube-go-demo, that coverage value is not correct.
I got coverage is 87.5% in local, but there is 64.3% in sonarqube.
Steps to Reproduce
There is tips for sonarqube:


But:
go test ./... -coverprofile=coverage.out
? github.com/yangwenmai/sonarqube-go-demo [no test files]
ok github.com/yangwenmai/sonarqube-go-demo/math 0.008s coverage: 87.5% of statements
I think the coverage of the calculation is wrong!
The coverage's result is 87.5%, not include sonarqube-go-demo/main.go#main()
Content of your sonar-project.properties
sonar.projectKey=demo
sonar.projectName=demo
sonar.sources=.
sonar.exclusions=**/*_test.go,**/vendor/**
sonar.tests=.
sonar.test.inclusions=**/*_test.go
sonar.test.exclusions=**/vendor/**
sonar.go.coverage.reportPaths=coverage.out
sonar.go.tests.reportPaths=report.json
sonar.go.govet.reportPaths=govet-report.out
sonar.go.golint.reportPaths=golint-report.out
sonar.go.gometalinter.reportPaths=gometalinter-report.out
Versions
Docker images: kennyallen/sonarqube:7.2.1
SonarQube Scanner for Jenkins: 2.6.1
gometalinter: master
go: 1.10.3
Hello @yangwenmai,
I don't understand the 55.6% value. On the screenshot the coverage percent is 64,3%. Could you explain ?