Skip to content
Latchkey

Go workflow (uber-go/nilaway)

The Go workflow from uber-go/nilaway, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: uber-go/nilaway.github/workflows/ci.ymlLicense Apache-2.0View source

What it does

This is the Go workflow from the uber-go/nilaway repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Go

on:
  push:
    branches: [ main ]
  pull_request:

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
        name: Check out repository

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: 1.25.x
          cache: false

      - name: Read golangci-lint version from .golangci.version
        id: golangci-version
        run: echo "GOLANGCI_VERSION=$(cat .golangci.version)" > $GITHUB_OUTPUT

      # We do not really run golangci-lint here (hence we use the -h flag). We just use the
      # golangci-lint action to install it and reuses its internal caching infrastructure.
      # The actual execution is done in the Lint job (together with other custom linting tasks).
      - uses: golangci/golangci-lint-action@v9
        name: Install golangci-lint
        with:
          version: v${{ steps.golangci-version.outputs.GOLANGCI_VERSION }}
          args: -h

      - name: Symlink installed golangci-lint to bin directory
        run: mkdir -p bin && ln -s $(which golangci-lint) bin/golangci-lint

      - run: make lint
        name: Lint

  test:
    name: Test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: [ "1.25.x", "1.26.x" ]
    steps:
      - uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}
          cache: true

      - name: Load cached dependencies
        uses: actions/cache@v5
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

      - name: Download dependencies
        run: go mod download

      - name: Build
        run: make build

      - name: Test and generate coverage report
        run: make cover

      - name: Upload coverage to codecov.io
        uses: codecov/codecov-action@v6
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

  integration-test:
    name: Integration Test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: [ "1.25.x", "1.26.x" ]
    steps:
      - uses: actions/checkout@v6

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}
          cache: true

      - name: Load cached dependencies
        uses: actions/cache@v5
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}

      - name: Download dependencies
        run: go mod download

      - name: Run integration tests
        run: make integration-test

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Go
 
on:
  push:
    branches: [ main ]
  pull_request:
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
  lint:
    timeout-minutes: 30
    name: Lint
    runs-on: latchkey-small
    steps:
      - uses: actions/checkout@v6
        name: Check out repository
 
      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: 1.25.x
          cache: false
 
      - name: Read golangci-lint version from .golangci.version
        id: golangci-version
        run: echo "GOLANGCI_VERSION=$(cat .golangci.version)" > $GITHUB_OUTPUT
 
      # We do not really run golangci-lint here (hence we use the -h flag). We just use the
      # golangci-lint action to install it and reuses its internal caching infrastructure.
      # The actual execution is done in the Lint job (together with other custom linting tasks).
      - uses: golangci/golangci-lint-action@v9
        name: Install golangci-lint
        with:
          version: v${{ steps.golangci-version.outputs.GOLANGCI_VERSION }}
          args: -h
 
      - name: Symlink installed golangci-lint to bin directory
        run: mkdir -p bin && ln -s $(which golangci-lint) bin/golangci-lint
 
      - run: make lint
        name: Lint
 
  test:
    timeout-minutes: 30
    name: Test
    runs-on: latchkey-small
    strategy:
      matrix:
        go: [ "1.25.x", "1.26.x" ]
    steps:
      - uses: actions/checkout@v6
 
      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}
          cache: true
 
      - name: Load cached dependencies
        uses: actions/cache@v5
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
 
      - name: Download dependencies
        run: go mod download
 
      - name: Build
        run: make build
 
      - name: Test and generate coverage report
        run: make cover
 
      - name: Upload coverage to codecov.io
        uses: codecov/codecov-action@v6
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
 
  integration-test:
    timeout-minutes: 30
    name: Integration Test
    runs-on: latchkey-small
    strategy:
      matrix:
        go: [ "1.25.x", "1.26.x" ]
    steps:
      - uses: actions/checkout@v6
 
      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go }}
          cache: true
 
      - name: Load cached dependencies
        uses: actions/cache@v5
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
 
      - name: Download dependencies
        run: go mod download
 
      - name: Run integration tests
        run: make integration-test
 

What changed

2 third-party actions are referenced by a movable tag. Pin them to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 3 jobs (5 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow