fix(cmd): Handle imbalanced LHS and RHS in defer assignment #189
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: ['*'] | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Test / Go ${{ matrix.go-version }} / ${{ matrix.os }}/${{ matrix.arch }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go-version: ['1.22.x', '1.21.x', '1.20.x'] | |
arch: ['amd64', '386', 'arm64'] | |
os: ['ubuntu-latest'] | |
include: | |
- os: 'macos-latest' | |
arch: 'amd64' | |
go-version: '1.22.x' | |
- os: 'windows-latest' | |
arch: 'amd64' | |
go-version: '1.22.x' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
# GH runners use amd64 which also support 386. | |
# For other architectures, use qemu. | |
- name: Install QEMU | |
if: matrix.arch != 'amd64' && matrix.arch != '386' | |
uses: docker/setup-qemu-action@v3 | |
- name: Enable race detection | |
shell: bash | |
run: | | |
# Only amd64 support data-race detection in CI. | |
# qemu doesn't give us cgo, which is needed for arm64. | |
if [[ "$GOARCH" == amd64 ]]; then | |
echo "Enabling data-race detection." | |
else | |
echo "NO_RACE=1" >> "$GITHUB_ENV" | |
fi | |
env: | |
GOARCH: ${{ matrix.arch }} | |
- name: Test ${{ matrix.arch }} | |
run: make cover | |
shell: bash | |
env: | |
GOARCH: ${{ matrix.arch }} | |
- name: Coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./cover.unsafe.out,./cover.safe.out | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Check out repository | |
- uses: actions/setup-go@v5 | |
name: Set up Go | |
with: | |
# Use the Go version specified in the go.mod for linting. | |
go-version-file: go.mod | |
cache: false # managed by golangci-lint | |
- uses: golangci/golangci-lint-action@v4 | |
name: Install golangci-lint | |
with: | |
version: latest | |
args: --help # make lint will run the linter | |
- name: Lint | |
run: make lint GOLANGCI_LINT_ARGS=--out-format=github-actions | |
# Write in a GitHub Actions-friendly format | |
# to annotate lines in the PR. | |
# ci-ok is a dummy job that runs after test and lint. | |
# It provides a job for us to attach a Required Status Check to. | |
ci-ok: | |
name: OK | |
runs-on: ubuntu-latest | |
needs: [test, lint] | |
steps: | |
- name: Success | |
run: echo "All checks passed." |