Skip to content

Commit e73628a

Browse files
vhvb1989Copilot
andcommitted
fix: resolve CI pipeline failures
- Rename allSubPtrs to allSubSlice to fix cspell 'Unknown word (Ptrs)' - Route spinner output through console.GetWriter() with io.Discard fallback to prevent stdout writes in tests (CI stdout check) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 065062a commit e73628a

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

cli/azd/cmd/config_sub_filter.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"cmp"
88
"context"
99
"fmt"
10+
"io"
1011
"slices"
1112
"strings"
1213

@@ -90,7 +91,8 @@ func (a *subFilterSetAction) Run(
9091
// Load subscriptions
9192
var subscriptions []account.Subscription
9293
loadingSpinner := ux.NewSpinner(&ux.SpinnerOptions{
93-
Text: "Loading subscriptions...",
94+
Text: "Loading subscriptions...",
95+
Writer: spinnerWriter(a.console),
9496
})
9597

9698
err := loadingSpinner.Run(ctx, func(ctx context.Context) error {
@@ -286,7 +288,8 @@ func (a *subFilterRemoveAction) Run(
286288
// Load subscriptions for tenant resolution
287289
var subscriptions []account.Subscription
288290
loadingSpinner := ux.NewSpinner(&ux.SpinnerOptions{
289-
Text: "Loading subscriptions...",
291+
Text: "Loading subscriptions...",
292+
Writer: spinnerWriter(a.console),
290293
})
291294

292295
err := loadingSpinner.Run(ctx, func(ctx context.Context) error {
@@ -429,3 +432,12 @@ func resolveTenantForFilter(
429432
return tenants[selectedIndex].Id,
430433
tenants[selectedIndex].DisplayName, nil
431434
}
435+
436+
// spinnerWriter returns the console's writer for spinner output,
437+
// falling back to io.Discard when nil (e.g. in tests).
438+
func spinnerWriter(console input.Console) io.Writer {
439+
if w := console.GetWriter(); w != nil {
440+
return w
441+
}
442+
return io.Discard
443+
}

cli/azd/pkg/prompt/prompt_service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,11 @@ func (ps *promptService) PromptSubscription(
355355

356356
// If user selected "Show all subscriptions", re-prompt with full list
357357
if result != nil && result.Id == ShowAllSubscriptionsOption {
358-
allSubPtrs := make(
358+
allSubSlice := make(
359359
[]*account.Subscription, len(unfilteredSubs),
360360
)
361361
for i := range unfilteredSubs {
362-
allSubPtrs[i] = &unfilteredSubs[i]
362+
allSubSlice[i] = &unfilteredSubs[i]
363363
}
364364

365365
return PromptCustomResource(
@@ -368,7 +368,7 @@ func (ps *promptService) PromptSubscription(
368368
LoadData: func(
369369
ctx context.Context,
370370
) ([]*account.Subscription, error) {
371-
return allSubPtrs, nil
371+
return allSubSlice, nil
372372
},
373373
DisplayResource: func(
374374
subscription *account.Subscription,

0 commit comments

Comments
 (0)