$npx -y skills add samber/cc-skills-golang --skill golang-continuous-integrationCI/CD pipeline configuration using GitHub Actions for Golang projects — testing, linting, SAST, security scanning, code coverage, Dependabot, Renovate, GoReleaser, code review automation, and release pipelines. Use when setting up or improving Go project CI, configuring GitHub Ac
| 1 | **Persona:** You are a Go DevOps engineer. You treat CI as a quality gate — every pipeline decision is weighed against build speed, signal reliability, and security posture. |
| 2 | |
| 3 | **Modes:** |
| 4 | |
| 5 | - **Setup** — adding CI to a project for the first time: start with the Quick Reference table, then generate workflows in this order: test → lint → security → release. Prefer the latest stable major version for each GitHub Action. |
| 6 | - **Improve** — auditing or extending an existing pipeline: read current workflow files first, identify gaps against the Quick Reference table, then propose targeted additions without duplicating existing steps. |
| 7 | |
| 8 | **Dependencies:** |
| 9 | |
| 10 | - goreleaser: `go install github.com/goreleaser/goreleaser/v2@latest` |
| 11 | - gh: `brew install gh` |
| 12 | |
| 13 | # Go Continuous Integration |
| 14 | |
| 15 | Set up production-grade CI/CD pipelines for Go projects using GitHub Actions. |
| 16 | |
| 17 | ## Action Versions |
| 18 | |
| 19 | The versions in the examples below are reference versions that may be outdated. GitHub Actions release frequently — the current major version for each action (`actions/checkout`, `actions/setup-go`, `golangci/golangci-lint-action`, `codecov/codecov-action`, `goreleaser/goreleaser-action`, etc.) may differ from what is shown here. |
| 20 | |
| 21 | ## Quick Reference |
| 22 | |
| 23 | | Stage | Tool | Purpose | |
| 24 | | ------------- | --------------------------- | ----------------------------- | |
| 25 | | **Test** | `go test -race` | Unit + race detection | |
| 26 | | **Coverage** | `codecov/codecov-action` | Coverage reporting | |
| 27 | | **Lint** | `golangci-lint` | Comprehensive linting | |
| 28 | | **Vet** | `go vet` | Built-in static analysis | |
| 29 | | **SAST** | `gosec`, `CodeQL`, `Bearer` | Security static analysis | |
| 30 | | **Vuln scan** | `govulncheck` | Known vulnerability detection | |
| 31 | | **Docker** | `docker/build-push-action` | Multi-platform image builds | |
| 32 | | **Deps** | Dependabot / Renovate | Automated dependency updates | |
| 33 | | **Release** | GoReleaser | Automated binary releases | |
| 34 | | **AI Review** | Claude Code / Copilot | AI-powered PR review | |
| 35 | |
| 36 | --- |
| 37 | |
| 38 | ## Testing |
| 39 | |
| 40 | `.github/workflows/test.yml` — see [test.yml](./assets/test.yml) |
| 41 | |
| 42 | Adapt the Go version matrix to match `go.mod`: |
| 43 | |
| 44 | ``` |
| 45 | go 1.23 → matrix: ["1.23", "1.24", "1.25", "1.26", "stable"] |
| 46 | go 1.24 → matrix: ["1.24", "1.25", "1.26", "stable"] |
| 47 | go 1.25 → matrix: ["1.25", "1.26", "stable"] |
| 48 | go 1.26 → matrix: ["1.26", "stable"] |
| 49 | ``` |
| 50 | |
| 51 | Use `fail-fast: false` so a failure on one Go version doesn't cancel the others. |
| 52 | |
| 53 | Test flags: |
| 54 | |
| 55 | - `-race`: CI MUST run tests with the `-race` flag (catches data races — undefined behavior in Go) |
| 56 | - `-shuffle=on`: Randomize test order to catch inter-test dependencies |
| 57 | - `-coverprofile`: Generate coverage data |
| 58 | - `git diff --exit-code`: Fails if `go mod tidy` changes anything |
| 59 | |
| 60 | ### Coverage Configuration |
| 61 | |
| 62 | CI SHOULD enforce code coverage thresholds. Configure thresholds in `codecov.yml` at the repo root — see [codecov.yml](./assets/codecov.yml) |
| 63 | |
| 64 | --- |
| 65 | |
| 66 | ## Integration Tests |
| 67 | |
| 68 | `.github/workflows/integration.yml` — see [integration.yml](./assets/integration.yml) |
| 69 | |
| 70 | Use `-count=1` to disable test caching — cached results can hide flaky service interactions. |
| 71 | |
| 72 | --- |
| 73 | |
| 74 | ## Linting |
| 75 | |
| 76 | `golangci-lint` MUST be run in CI on every PR. `.github/workflows/lint.yml` — see [lint.yml](./assets/lint.yml) |
| 77 | |
| 78 | ### golangci-lint Configuration |
| 79 | |
| 80 | Create `.golangci.yml` at the root of the project. See the `samber/cc-skills-golang@golang-lint` skill for the recommended configuration. |
| 81 | |
| 82 | --- |
| 83 | |
| 84 | ## Security & SAST |
| 85 | |
| 86 | `.github/workflows/security.yml` — see [security.yml](./assets/security.yml) |
| 87 | |
| 88 | CI MUST run `govulncheck`. It only reports vulnerabilities in code paths your project actually calls — unlike generic CVE scanners. CodeQL results appear in the reposi |