Go
Language-specific information about the way that SonarQube Cloud supports the analysis of Go files.
Last updated
Was this helpful?
Language-specific information about the way that SonarQube Cloud supports the analysis of Go files.
The level of support for a language is defined as follows:
Fully supported: Analysis will complete. All the language features are understood and examined.
Supported: Most language features are understood and examined but the version includes unsupported features. Analysis might break or provide incomplete results.
Versions 1.0 to 1.25 are supported.
SonarScanner should run on a x86-64 Windows, macOS or Linux 64bits machine.
You need the Go installation on the scan machine only if you want to import coverage data.
To discover and update the Go-specific properties, navigate in SonarQube Cloud to Your Project > Administration > General Settings > Languages > Go. See Configuration overview for more information about setting properties.
By default, all the vendor directories are excluded from the analysis. However, you can change the property sonar.go.exclusions to a different pattern if you want to force their analysis (not recommended).
If you modify the sonar.go.exclusions or the sonar.sources property, be sure that go.mod files are included in your scan. If the go.mod files are excluded, the analysis results are less precise.
Here is a first version of a sonar-project.properties file, valid for a simple Go project:
Adding the //NOSONAR comment at the end of the line will suppress all issues on that line.
Rather than relying on this method, we suggest refining your analysis scope to avoid creating major gaps in your code review. Because the NOSONAR comment silences all current and future issues on a line without regard for their severity, it is an imprecise tool. Even if you only intend to hide a minor stylistic point, you could unintentionally obscure a serious security flaw.
External analyzer reports(GoVet, GoLint, GoMetaLinter)
Last updated
Was this helpful?
Was this helpful?
sonar.projectKey=com.company.projectkey1
sonar.projectName=My Project Name
sonar.tests=.
sonar.test.inclusions=**/*_test.go
