Skip to content
Example for analyzing Go code with SonarQube (including Github Action).
HTML Other
  1. HTML 98.2%
  2. Other 1.8%
Branch: master
Clone or download

Latest commit

Latest commit 87f8e5c Nov 2, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Split jobs. (#2) Nov 2, 2019
.gitignore first commit Feb 9, 2019
.gitlab-ci.yml
Makefile first commit Feb 9, 2019
README.md Fixed GH Actions Badge. Oct 28, 2019
go.mod first commit Feb 9, 2019
index.html first commit Feb 9, 2019
main.go first commit Feb 9, 2019
main_test.go first commit Feb 9, 2019
sonar-project.properties Code Coverage for GH Action (#1) Oct 28, 2019

README.md

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.

You can’t perform that action at this time.