mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-28 14:00:49 -04:00
Go 1.24 introduces stricter checks for format string validation. This commit fixes instances where non-constant format strings were used in calls to functions like `fmt.Errorf`, `fmt.Printf`, and similar. Changes include: - Replacing dynamically constructed strings passed as format strings with constant format strings. - Refactoring `fmt.Sprintf` calls to ensure the format string matches the number of arguments provided. - Simplifying redundant formatting and ensuring compliance with Go 1.24's stricter `vet` tool checks. This update ensures compatibility with Go 1.24 and prevents potential runtime errors caused by misinterpreted dynamic format strings. Resolves #2389 Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info> Co-authored-by: Martin Atkins <mart@degeneration.co.uk> Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
How to run tests
To run them, use:
TFE_TOKEN=<token> TFE_HOSTNAME=<hostname> TF_ACC=1 go test ./internal/cloud/e2e/... -ldflags "-X \"github.com/opentofu/opentofu/version.Prerelease=<PRE-RELEASE>\""
Required flags
TF_ACC=1. This variable is used as part of tofu for tests that make external network calls. This is needed to run these tests. Without it, the tests do not run.TFE_TOKEN=<admin token>andTFE_HOSTNAME=<hostname>. The helpers for these tests require admin access to a TFC/TFE instance.-timeout=30m. Some of these tests take longer than the default 10m timeout forgo test.
Flags
- Use the
-vflag for normal verbose mode. - Use the
-tfoutputflag to print the tofu output to standard out. - Use
-ldflagsto change the version Prerelease to match a version available remotely. Some behaviors rely on the exact local version OpenTofu being available in TFC/TFE, and manipulating the Prerelease during build is often the only way to ensure this. (More on-ldflags.)