We do understand that at the root this is GoLang problem.
We have GoLang files that have only constants and enums and the
go test command will ignore these from reports since it considers there is no logic in them. As a result Sonar will report that there is 0% coverage which breaks our Quality Gates.
We can work around the issue by adopting a naming convention and ignore files matching
**/*_enums.go from coverage but as soon as someone adds a method in these files, then the coverage will still be unreported, even though
go test will report coverage.
Many of our go dev are blaming Sonar, which is just the messenger, but the messenger could be a bit smarter about what to report based on the language. I suppose excluding import, const and enum lines as an option could take care of the mis reporting issue.