fix: update in piepline and add code verification #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go validations | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| go-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout do código | |
| - name: Checkout code | |
| uses: actions/checkout@v2 | |
| # Configurar Go | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: '1.24' | |
| # Instalar dependências Go (caso existam) | |
| #- name: Install Go dependencies | |
| # run: | | |
| # go mod tidy | |
| # Instalar as ferramentas de linting e formatação | |
| - name: Install Go tools | |
| run: | | |
| go install golang.org/x/lint/golint@latest | |
| go install golang.org/x/tools/cmd/goimports@latest | |
| go install honnef.co/go/tools/cmd/staticcheck@latest | |
| # Rodar gofmt | |
| - name: Run gofmt | |
| run: | | |
| echo "Running gofmt..." | |
| gofmt -w . | |
| git diff --exit-code || (echo "gofmt: Code needs formatting!" && exit 1) | |
| # Rodar golint | |
| - name: Run golint | |
| run: | | |
| echo "Running golint..." | |
| golint ./... | |
| # Se golint encontrar algum erro, a pipeline falha | |
| if [ $? -ne 0 ]; then | |
| echo "golint: Found linting issues!" && exit 1 | |
| fi | |
| # Rodar goimports | |
| - name: Run goimports | |
| run: | | |
| echo "Running goimports..." | |
| goimports -w . | |
| git diff --exit-code || (echo "goimports: Code needs imports formatting!" && exit 1) | |
| # Rodar staticcheck | |
| #- name: Run staticcheck | |
| # run: | | |
| # echo "Running staticcheck..." | |
| # staticcheck ./... | |
| # # Se staticcheck encontrar problemas, a pipeline falha | |
| # if [ $? -ne 0 ]; then | |
| # echo "staticcheck: Found issues!" && exit 1 | |
| # fi |