Skip to content

Fix non-constant format string vet errors for Go 1.26 toolchain#446

Open
mchen727 wants to merge 1 commit into
releases/v0.26.0from
mchen/v0.26.0-go1.26-govet-fix
Open

Fix non-constant format string vet errors for Go 1.26 toolchain#446
mchen727 wants to merge 1 commit into
releases/v0.26.0from
mchen/v0.26.0-go1.26-govet-fix

Conversation

@mchen727

Copy link
Copy Markdown
Contributor

Backports main's Go 1.26 compatibility fix to releases/v0.26.0.

The moc-service-release build now uses the latest MS Go toolchain (go-aka 1.26.5-2), whose go test printf analyzer rejects non-constant format strings as errors. This branch's Go 1.22-era code failed make unittest while main already carries the equivalent fixes.

Adds a constant "%s" verb to the flagged Wrapf/Errorf/Fatalf calls in pkg/validations, pkg/status, pkg/config, pkg/certs, pkg/redact.

Validated: go test -vet=printf -run '^$' ./pkg/... reports 0 non-constant format string issues.

The moc-service-release build now uses the latest MS Go toolchain
(go-aka 1.26.5-2), whose `go test` printf vet analyzer rejects
non-constant format strings as errors. The releases/v0.26.0 branch
(Go 1.22-era code) failed to build under this toolchain while main
already carries the equivalent fixes.

Add a constant "%s" format verb to the flagged Wrapf/Errorf/Fatalf
call sites in pkg/validations, pkg/status, pkg/config, pkg/certs,
and pkg/redact so `go test ./pkg/...` passes under Go 1.26.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: a5fc3af6-9324-437e-9933-0bf3cc26b490
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

2 participants