From 73697d40377c9adfdf97273214e59145de7b4b32 Mon Sep 17 00:00:00 2001 From: marcusDenslow Date: Sat, 23 May 2026 21:19:25 +0200 Subject: [PATCH] ci(checks): add pull request workflow and golangci-lint config --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ .golangci.yml | 16 ++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .golangci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6e52b1e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: + pull_request: + branches: [master] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build + run: go build ./... + + - name: Vet + run: go vet ./... + + - name: Format check + run: | + unformatted=$(gofmt -l $(go list -f '{{.Dir}}' ./...)) + if [ -n "$unformatted" ]; then + echo "These files need gofmt:" + echo "$unformatted" + exit 1 + fi + + - name: Lint + uses: golangci/golangci-lint-action@v7 + with: + version: v2.4.0 + + - name: Test (race detector) + run: go test -race ./... diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..3d929d7 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,16 @@ +version: "2" + +run: + timeout: 5m + +linters: + default: none + enable: + - errcheck + - govet + - ineffassign + - staticcheck + - unused + exclusions: + paths: + - terminal-shop-source \ No newline at end of file