Skip to content
Latchkey

Go workflow (uber-go/zap)

The Go workflow from uber-go/zap, 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/zap.github/workflows/go.ymlLicense MITView source

What it does

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

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

The workflow

workflow (.yml)
name: Go

on:
  push:
    branches: [master]
    tags: ['v*']
  pull_request:
    branches: ['*']

permissions:
  contents: read

jobs:

  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go: ["1.25.x", "1.26.x"]
        include:
        - go: 1.26.x

    steps:
    - name: Checkout code
      uses: actions/checkout@v4

    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go }}
        cache-dependency-path: '**/go.sum'

    - name: Download Dependencies
      run: |
        go mod download
        (cd tools && go mod download)
        (cd benchmarks && go mod download)
        (cd zapgrpc/internal/test && go mod download)

    - name: Test
      run: make cover

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

  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:
        go-version: 1.26.x
        cache: false  # managed by golangci-lint

    - uses: golangci/golangci-lint-action@v6
      name: Install golangci-lint
      with:
        version: latest
        # Hack: Use the official action to download, but not run.
        # make lint below will handle actually running the linter.
        args: --help

    - run: make lint
      name: Lint

    - name: vulncheck
      run: make vulncheck

The same workflow, on Latchkey

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

name: Go
 
on:
  push:
    branches: [master]
    tags: ['v*']
  pull_request:
    branches: ['*']
 
permissions:
  contents: read
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  build:
    timeout-minutes: 30
    runs-on: latchkey-small
    strategy:
      matrix:
        go: ["1.25.x", "1.26.x"]
        include:
        - go: 1.26.x
 
    steps:
    - name: Checkout code
      uses: actions/checkout@v4
 
    - name: Setup Go
      uses: actions/setup-go@v5
      with:
        go-version: ${{ matrix.go }}
        cache-dependency-path: '**/go.sum'
 
    - name: Download Dependencies
      run: |
        go mod download
        (cd tools && go mod download)
        (cd benchmarks && go mod download)
        (cd zapgrpc/internal/test && go mod download)
 
    - name: Test
      run: make cover
 
    - name: Upload coverage to codecov.io
      uses: codecov/codecov-action@v5
      with:
        verbose: true
        token: ${{ secrets.CODECOV_TOKEN }}
 
  lint:
    timeout-minutes: 30
    name: Lint
    runs-on: latchkey-small
 
    steps:
    - uses: actions/checkout@v4
      name: Check out repository
    - uses: actions/setup-go@v5
      name: Set up Go
      with:
        go-version: 1.26.x
        cache: false  # managed by golangci-lint
 
    - uses: golangci/golangci-lint-action@v6
      name: Install golangci-lint
      with:
        version: latest
        # Hack: Use the official action to download, but not run.
        # make lint below will handle actually running the linter.
        args: --help
 
    - run: make lint
      name: Lint
 
    - name: vulncheck
      run: make vulncheck
 

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 2 jobs (3 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