smeetpt / service_sonar

Example for analyzing Go code with SonarQube (including Github Action).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SonarCloud

Example for SonarQube with Go

Example on static analysis of Go code using SonarQube for the blog post Go for SonarQube. This example uses Go Modules so you need to set GO_MODULES="on".

Start SonarQube

docker run -d --name sonarqube -p 9000:9000 sonarqube

Run SonarQube analysis

docker run --rm --network host --mount type=volume,src="$(pwd)",dst=/opt/app,type=bind -w=/opt/app red6/docker-sonar-scanner:latest sonar-scanner -Dsonar.login=**SECRET**

Github Action

This project also uses Github Actions as documented in Scan your code with SonarCloud.

Code coverage is analyzed during the test and then reported to SonarCloud using upload-artifact and download-artifact.

About

Example for analyzing Go code with SonarQube (including Github Action).


Languages

Language:HTML 98.2%Language:Makefile 0.9%Language:Go 0.9%