Skip to content

Update dependencies to make security checks pass, pushing minimum Go version to 1.26 - #234

Open
rweir wants to merge 8 commits into
openzipkin:masterfrom
rweir:update-dependencies
Open

rweir wants to merge 8 commits into
openzipkin:masterfrom
rweir:update-dependencies

Conversation

@rweir

@rweir rweir commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

I noticed that CI on master fails because Trivy flags the current versions of several dependencies as having vulnerabilities. This PR updates dependencies to versions that Trivy is OK with, and updates the linter and CI config to work, and fixes some new lints discovered and a bug exposed by using Go > 1.20. Unfortunately, this required raising the minimum Go version to 1.26 (current version - 1), which specifically breaks the policy in the README of running under the two previous versions. I've not edited the policy in this PR, and I completely understand if this isn't an acceptable move. Either way, CI is green on my branch: tests, security.

They are mostly mechanical changes: I used a small script to first find the minimum dependency versions govulncheck was happy with (since it can check at the symbol level):

$ go run golang.org/x/vuln/cmd/govulncheck@latest -format json ./... \
  | jq -r 'select(.finding.trace[0].function) | .finding | "\(.trace[0].module)@\(.fixed_version)"' \
  | sort -u -V \
  | awk -F@ '{ v[$1] = $2 } END { for (m in v) print m "@" v[m] }'
github.com/klauspost/compress@v1.20.2
golang.org/x/text@v0.39.0
golang.org/x/net@v0.60.0
github.com/rabbitmq/amqp091-go@v1.14.0

I then ran go get on the output. These updates required moving forward the minimum Go version, all the way to 1.26. In particular, github.com/klauspost/compress@v1.20.2 and golang.org/x/text@v0.39.0 force the minimum Go version to 1.25, golang.org/x/net@v0.60.0 forces it to 1.26. github.com/rabbitmq/amqp091-go continues to work on Go 1.20.

Trivy then wanted two more updates (x/net -> 0.62.0, and grpc -> 1.83.2, which required protobuf -> 1.36.11) - since it works at the module version level not the symbol level - but that didn't move the minimum Go version beyond 1.26.

The rest of the changes:

  • Moving past 1.21 required a small panic fix (two commits, this was a pre-existing latent bug that could already be hit by users of this library that used a Go version > 1.20)
  • golangci-lint needed to be updated to a version that could run under Go 1.26 and Go 1.27, and it mechanically updated its own config (one commit)
  • fixing/disabling the new lint issues (two commits)
  • updating CI to only run against Go 1.26 (linux) and 1.27 (macos,windows,linux) (one commit)

This would also supersede #232 .

… move to go 1.26

```shell
go get $(go run golang.org/x/vuln/cmd/govulncheck@latest -format json ./... \
  | jq -r 'select(.finding.trace[0].function) | .finding | "\(.trace[0].module)@\(.fixed_version)"' \
  | sort -u -V \
  | awk -F@ '{ v[$1] = $2 } END { for (m in v) print m "@" v[m] }')
github.com/klauspost/compress@v1.20.2
golang.org/x/text@v0.39.0
golang.org/x/net@v0.60.0
github.com/rabbitmq/amqp091-go@v1.14.0
```

Unfortunately, this requires moving forward the minimum Go version,
all the way to 1.26.  In particular,
`github.com/klauspost/compress@v1.20.2` and
`golang.org/x/text@v0.39.0` force the minimum Go version to 1.25,
`golang.org/x/net@v0.60.0` forces it to 1.26.
`github.com/rabbitmq/amqp091-go` continues to work on Go 1.20.
Trivy is slightly stricter than `vulncheck` so requires a few
dependencies to be updated further.  Generated by running `trivy fs
--scanners vuln,secret --severity HIGH,CRITICAL .` and then running
`go get`.
Since Go 1.21[0], passing `nil` to `panic()` causes its own panic.
Based on the surrounding code, I think this line was a typo and should
always have passed the value it just checked wasn't `nil`.

0: https://go.dev/doc/go1.21#language
The `err` field in the `policies` table was being used for two
purposes - the return value of `NewTracer` and the value being passed
to `panic()` in case of failure (ie what `recover()` will get).  Now
that the previous commit ensured `nil` can't be passed to `panic()`,
expand the table to split up the two concepts and provide a specific
error for the `ExtractFailurePolicyError` case.
manually updated the workflow and allowed `golangci` to migrate the
config with `golangci-lint migrate`.  `revive` was listed twice in the
list, it remains there after the conversion.
It produced 26 complaints for test files, doesn't seem very useful to
make them all use constants.
all the functions in use were just moved to the `io` package.
tests: drop Go 1.25 run; min version for updated dependencies is 1.26
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.78%. Comparing base (87e3b85) to head (5dd453b).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
middleware/http/transport.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #234      +/-   ##
==========================================
- Coverage   66.83%   63.78%   -3.06%     
==========================================
  Files          36       43       +7     
  Lines        1770     2278     +508     
==========================================
+ Hits         1183     1453     +270     
- Misses        542      825     +283     
+ Partials       45        0      -45     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant