Skip to content

Instantly share code, notes, and snippets.

View ralvescosta's full-sized avatar
🎯
Focusing

Rafael A. C ralvescosta

🎯
Focusing
View GitHub Profile
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c8.yml
Created March 20, 2022 12:06
How to configure CircleCI and SonarQube for GoLang Application
version: 2.1
jobs:
lint:
working_directory: ~/repo
docker:
- image: golangci/golangci-lint:v1.45
steps:
- checkout
- run: golangci-lint run ./... --out-format=checkstyle --print-issued-lines=false --print-linter-name=false --issues-exit-code=0 --enable=revive > golanci-report.xml
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c7.yml
Created March 20, 2022 12:04
How to configure CircleCI and SonarQube for GoLang Application
jobs:
sonar:
working_directory: ~/repo
docker:
- image: circleci/golang:1.17
steps:
- checkout
- attach_workspace:
at: ~/repo
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_s1.properties
Created March 20, 2022 12:02
How to configure CircleCI and SonarQube for GoLang Application
# =====================================================
# Standard properties
# =====================================================
sonar.projectKey=YOUR_SONAR_PROJECT_KEY
sonar.organization=YOUR_SONAR_ORGANIZATION
sonar.projectVersion=1.0
sonar.sources=pkg
sonar.exclusions=**/*_test.go,**/vendor/**
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c6.yml
Created March 20, 2022 11:58
How to configure CircleCI and SonarQube for GoLang Application
workflows:
ci:
jobs:
- lint
- test_and_coverage
- build
- requires:
- lint
- test_and_coverage
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c5.yml
Created March 20, 2022 11:56
How to configure CircleCI and SonarQube for GoLang Application
jobs:
test_and_coverage:
working_directory: ~/repo
docker:
- image: circleci/golang:1.17
steps:
- checkout
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c4.yml
Created March 20, 2022 11:54
How to configure CircleCI and SonarQube for GoLang Application
workflows:
ci:
jobs:
- lint
- build
- requires:
- lint
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c3.yml
Created March 20, 2022 11:50
How to configure CircleCI and SonarQube for GoLang Application
jobs:
lint:
working_directory: ~/repo
docker:
- image: golangci/golangci-lint:v1.45
steps:
- checkout
- run: golangci-lint run ./... --out-format=checkstyle --print-issued-lines=false --print-linter-name=false --issues-exit-code=0 --enable=revive > golanci-report.xml
- persist_to_workspace:
root: ~/repo
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c2.yml
Created March 20, 2022 11:47
How to configure CircleCI and SonarQube for GoLang Application
version: 2.1
jobs:
build:
working_directory: ~/repo
docker:
- image: circleci/golang:1.17
steps:
- checkout
- restore_cache:
@ralvescosta
ralvescosta / go_circleci_and_sonarqube_c1.yml
Created March 20, 2022 11:42
How to configure CircleCI and SonarQube for GoLang Application
version: 2.1
jobs:
- job_name
workflows:
- workflow_name
jobs:
- job_name
@ralvescosta
ralvescosta / express_route_adapt.js
Created June 20, 2021 22:39
Medium - Logs, Monitoring and NodeJs in Harmony - routeAdapt.js
const routesAdapt = (logger, controllerHandler) => {
return async (req, res, next) => {
const httpRequest = {
body: req.body,
headers: req.headers
}
try {
const result = await controllerHandler(httpRequest)
logger.error({ method: req.method, path: req.path, statusCode: result.statusCode })