mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Prepare for upgrade to golangci-lint v1.64.5
In a future commit we will adopt golangci-lint v1.64.5, which now triggers lint warnings for some code that was previously not detected. This commit is the smallest change to address those differences. Unfortunately the "cloud" package and the "remote" backend both rely on non-idiomatic error message formatting because they emit the returned error message text directly into the UI, so to avoid changing the UI output but also avoid significant refactoring this just adds nolint comments to those for now. A future commit might address this by reworking things so that the UI takes care of its own presentation concerns instead of relying on the main implementation to directly generate UI-appropriate error strings. This also completely disables the exportloopref linter, because that was for a loop scoping hazard that was already addressed by a language change in Go 1.22. This linter is therefore completely removed in newer versions of golangci-lint and would thus generate an error if left enabled after upgrading. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -340,6 +340,7 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op
|
||||
b.CLI.Output("\n------------------------------------------------------------------------")
|
||||
return nil
|
||||
case tfe.CostEstimateCanceled:
|
||||
//nolint:revive,stylecheck // Caller UI relies on this non-idiomatic error string form
|
||||
return fmt.Errorf("%s canceled.", msgPrefix)
|
||||
default:
|
||||
return fmt.Errorf("Unknown or unexpected cost estimate state: %s", ce.Status)
|
||||
@@ -417,8 +418,10 @@ func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Ope
|
||||
}
|
||||
continue
|
||||
case tfe.PolicyErrored:
|
||||
//nolint:revive,stylecheck // Caller UI relies on this non-idiomatic error string form
|
||||
return fmt.Errorf("%s errored.", msgPrefix)
|
||||
case tfe.PolicyHardFailed:
|
||||
//nolint:revive,stylecheck // Caller UI relies on this non-idiomatic error string form
|
||||
return fmt.Errorf("%s hard failed.", msgPrefix)
|
||||
case tfe.PolicySoftFailed:
|
||||
runUrl := fmt.Sprintf(runHeader, b.hostname, b.organization, op.Workspace, r.ID)
|
||||
|
||||
Reference in New Issue
Block a user