A comprehensive, type-safe Go client library and command-line interface for the SonarQube Web API. Whether you're building automation tools, integrating SonarQube into your CI/CD pipeline, or managing your SonarQube instance from the terminal - this project has you covered.
📖 Documentation: https://boxboxjason.github.io/sonarqube-client-go/ · 📚 API reference: pkg.go.dev
- Go SDK: strongly typed options and responses for every SonarQube V1 and V2 API service, token or basic authentication, opt-in retries with backoff, HTTP middleware for logging and tracing.
- CLI (
sonar-cli): every service and method as a subcommand, JSON / YAML / table output, automatic pagination with--all, shell completion. - Tested with unit tests and integration tests against real SonarQube Community and Enterprise instances.
go install github.com/boxboxjason/sonarqube-client-go/v2/cmd/sonar-cli@latest
export SONAR_CLI_URL=https://sonar.example.com
export SONAR_CLI_TOKEN=mytoken
sonar-cli issues search --projects my-project --severities CRITICAL,MAJOR --allgo get github.com/boxboxjason/sonarqube-client-go/v2/sonarclient, err := sonar.NewClient(nil,
sonar.WithBaseURL("https://sonarqube.example.com/api/"),
sonar.WithToken("my-token"),
)
if err != nil {
log.Fatal(err)
}
projects, _, err := client.Projects.Search(context.Background(), &sonar.ProjectsSearchOptions{
Query: "my-service",
})The documentation covers the CLI, the SDK, client configuration, errors and pagination and the list of services. It is built from the docs directory, and updated together with the code.
Contributions are welcome: read the Contributing Guide, which covers the development setup, the tests and the documentation.
- Report a bug with the steps to reproduce, the Go, OS and SonarQube versions, and a minimal reproducer.
- Request a feature.
- Do not open a public issue for a security vulnerability: email the maintainers privately with the details.
Licensed under the Apache License 2.0, see LICENSE.
