Skip to content

Commit 6c6d3e2

Browse files
committed
style(purchase,config): clear new-from-rev lint on OfferingClass diff
Resolve the three golangci-lint findings that --new-from-rev=origin/main attributes to the #694 OfferingClass changes: - errcheck: replace the silent `_ =` discard of SavePurchaseExecution on the processPurchaseRecommendations error path with the existing saveExecutionStatusBestEffort helper, which persists and logs the audit-save failure instead of dropping it. - gocritic unnamedResult: name the four results of processPurchaseRecommendations (its return set grew to include error); switch the trailing assignment from := to = accordingly. - misspell: pre-694 behaviour -> behavior in the ValidOfferingClasses doc. No behavior change to the purchase path; base-debt Lint/Security failures are pre-existing on main and out of scope.
1 parent f13fc38 commit 6c6d3e2

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎internal/config/validation.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func crossProviderPaymentAlias(provider, raw string) (string, bool) {
168168

169169
// ValidOfferingClasses lists the accepted EC2 RI offering class values for
170170
// GlobalConfig. The empty string is also accepted (maps to "convertible" at
171-
// purchase time to preserve pre-694 behaviour).
171+
// purchase time to preserve pre-694 behavior).
172172
var ValidOfferingClasses = []string{"convertible", "standard"}
173173

174174
// ValidRampScheduleTypes lists all supported ramp schedule types

‎internal/purchase/execution.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func (m *Manager) executeForAccount(ctx context.Context, baseExec *config.Purcha
250250
if procErr != nil {
251251
acctExec.Status = "failed"
252252
acctExec.Error = procErr.Error()
253-
_ = m.config.SavePurchaseExecution(ctx, &acctExec)
253+
m.saveExecutionStatusBestEffort(ctx, &acctExec)
254254
return false, procErr
255255
}
256256

@@ -507,7 +507,7 @@ type recPurchaseOutcome struct {
507507
err error
508508
}
509509

510-
func (m *Manager) processPurchaseRecommendations(ctx context.Context, exec *config.PurchaseExecution, plan *config.PurchasePlan, accountID string, provCfg *provider.ProviderConfig) (float64, float64, []string, error) {
510+
func (m *Manager) processPurchaseRecommendations(ctx context.Context, exec *config.PurchaseExecution, plan *config.PurchasePlan, accountID string, provCfg *provider.ProviderConfig) (totalSavings, totalUpfront float64, purchaseErrors []string, procErr error) {
511511
// ExecutionID is carried into PurchaseOptions so executeSinglePurchase
512512
// can tag every per-rec log line with the owning exec UUID. Without
513513
// this, CloudWatch filtering by exec ID returns zero hits and a stuck
@@ -590,7 +590,7 @@ func (m *Manager) processPurchaseRecommendations(ctx context.Context, exec *conf
590590
// there are no concurrent writes to totals, exec.Recommendations, or
591591
// purchaseErrors (05-N2). Do NOT move the aggregation inside the FanOut
592592
// closure or run it concurrently with the fan-out.
593-
totalSavings, totalUpfront, purchaseErrors := m.aggregatePurchaseOutcomes(ctx, exec, plan, accountID, results)
593+
totalSavings, totalUpfront, purchaseErrors = m.aggregatePurchaseOutcomes(ctx, exec, plan, accountID, results)
594594
return totalSavings, totalUpfront, purchaseErrors, nil
595595
}
596596

0 commit comments

Comments
 (0)