Skip to content

chore: add CI workflow with go test, gofmt, and golangci-lint #60

@gitcoder89431

Description

@gitcoder89431

Problem

There is no CI pipeline enforcing code quality on push or PR. This means formatting drift, test failures, and lint regressions can land silently.

Also, the "context" import in internal/app/update.go is in its own group between stdlib and third-party — goimports would normalize this. Running goimports -w ./... (not just gofmt) enforces the correct stdlib / external / internal grouping automatically.

Proposed Change

Add .github/workflows/ci.yml:

name: CI

on:
  push:
    branches: [main]
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-go@v5
        with:
          go-version-file: go.mod
          cache: true

      - name: Verify formatting (goimports)
        run: |
          go install golang.org/x/tools/cmd/goimports@latest
          diff <(goimports -l .) /dev/null

      - name: Run tests
        run: go test ./...

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v6
        with:
          version: latest

Also fix the "context" import grouping in internal/app/update.go as part of this PR by running goimports -w ./....

Why

  • go test ./... catches regressions before merge
  • goimports enforces consistent import grouping (stdlib / external / internal) automatically
  • golangci-lint catches unused variables, shadowed errors, missing error checks (errcheck), and style issues that gofmt misses
  • Takes ~15 minutes to set up and prevents an entire class of regressions permanently

Files

.github/workflows/ci.yml (new), internal/app/update.go (import fix)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions