Skip to content

lint

lint #9

Workflow file for this run

name: Go Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-and-lint:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.22.x"
- name: Run tests
if: ${{ !inputs.skipTests }}
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: Go Format
run: gofmt -s -w . && git diff --exit-code
- name: Go Vet
run: go vet ./...
- name: Upload Coverage
if: ${{ !inputs.skipTests }} # upload when we really run our tests
uses: codecov/codecov-action@v3
continue-on-error: true # we don't care if it fails
with:
token: ${{secrets.CODECOV_TOKEN}} # set in repository settings
file: ./coverage.txt # file from the previous step
fail_ci_if_error: false
cleanup:
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Delete merged branch
uses: dawidd6/action-delete-branch@v3