Skip to content

task: Install compatible go-test-coverage version based on Go version #95

@nexus49

Description

@nexus49

Overview

The shared CI workflow (job-golang-test-source.yml, line 54-55) installs go-test-coverage with @latest, which now resolves to v2.18.4 — a version requiring Go >= 1.26. Repos still on Go 1.25.x fail at the coverage step even though all tests pass.

Affected repos (known so far):

Any repo using GOTOOLCHAIN=local with Go < 1.26 will hit the same failure.

Root Cause

In .github/workflows/job-golang-test-source.yml:

# line 54-55
- name: Install Code Coverage
  run: go install github.com/vladopajic/go-test-coverage/v2@latest
go: github.com/vladopajic/go-test-coverage/v2@latest:
    github.com/vladopajic/go-test-coverage/v2@v2.18.4 requires go >= 1.26
    (running go 1.25.x; GOTOOLCHAIN=local)

Proposed Fix

Replace the static @latest install with version selection based on the active Go version:

- name: Install Code Coverage
  run: |
    GO_MINOR=$(go env GOVERSION | sed 's/go1\.\([0-9]*\).*/\1/')
    if [ "$GO_MINOR" -lt 26 ]; then
      go install github.com/vladopajic/go-test-coverage/v2@v2.17.1
    else
      go install github.com/vladopajic/go-test-coverage/v2@latest
    fi

This way repos on Go 1.25.x get the last compatible version (v2.17.1), while repos that upgrade to Go 1.26+ automatically get the latest.

File to modify

.github/workflows/job-golang-test-source.yml — line 54-55

Completion Checklist

  • Code implemented and tested
  • Documentation updated
  • Changes reviewed

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions