Skip to content

fix(tbtcpg/test): use constant format string in fmt.Errorf#3996

Open
piotr-roslaniec wants to merge 1 commit into
mainfrom
fix/tbtcpg-test-fmt-errorf
Open

fix(tbtcpg/test): use constant format string in fmt.Errorf#3996
piotr-roslaniec wants to merge 1 commit into
mainfrom
fix/tbtcpg-test-fmt-errorf

Conversation

@piotr-roslaniec
Copy link
Copy Markdown
Collaborator

Summary

  • go vet (run automatically by go test) rejects fmt.Errorf(unmarshaled.ExpectedErr) because the format string is not a compile-time constant. This is what's currently breaking the client-integration-test job on main:

    pkg/tbtcpg/internal/test/marshaling.go:276:33:
      non-constant format string in call to fmt.Errorf
    

    Which surfaces as pkg/tbtcpg/internal/test [build failed] in the test output.

  • Fix: wrap the dynamic string in %s so the format string is constant.

Test plan

  • Locally: go test -tags=integration -c -o /dev/null ./pkg/tbtcpg/internal/test/ succeeds (previously failed)
  • Client workflow no longer reports pkg/tbtcpg/internal/test [build failed]

`go vet` (run by `go test`) rejects `fmt.Errorf(unmarshaled.ExpectedErr)`
because the format string is not a compile-time constant. This caused
the `client-integration-test` job in CI to fail with:

    pkg/tbtcpg/internal/test/marshaling.go:276:33:
      non-constant format string in call to fmt.Errorf

Wrap the value in `%s` so the format string is a constant and the
package builds again.
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