ronantakizawa/codereview-bench huggingface dataset:
Repository: cli/cli
File: pkg/cmd/gist/edit/edit_test.go (Go)

Code before:
					"sample.txt": map[string]interface{}{
						"content":  "data from stdin",
						"filename": "sample.txt",
					},
				},
			},
		},
		{
			name:  "no arguments notty",
			isTTY: false,
			opts: &EditOptions{
				Selector: "",
			},
			wantErr: "gist ID or URL required when not running interactively",
		},
		{
			name: "edit no-file gist (#10626)",
			opts: &EditOptions{
				Selector: "1234",
			},
			mockGist: &shared.Gist{
				ID:    "1234",
				Files: map[string]*shared.GistFile{},
				Owner: &shared.GistOwner{Login: "octocat"},
			},
			wantErr: "No file found in this gist.",
		},
	}

	for _, tt := range tests {
		reg := &httpmock.Registry{}
		pm := prompter.NewMockPrompter(t)

		if tt.opts == nil {
			tt.opts = &EditOptions{}
		}

		if tt.opts.Selector != "" {
			// Only register the HTTP stubs for a direct gist lookup if a selector is provided.
			if tt.mockGist == nil {
				// If no gist is provided, we expect a 404.
				reg.Register(httpmock.REST("GET", fmt.Sprintf("gists/%s", tt.opts.Selector)),
					httpmock.StatusStringResponse(404, "Not Found"))
			} else {
				// If a gist is provided, we expect the gist to be fetched.
				reg.Register(httpmock.REST("GET", fmt.Sprintf("gists/%s", tt.opts.Selector)),
					httpmock.JSONResponse(tt.mockGist))
				reg.Register(httpmock.GraphQL(`query UserCurrent\b`),
					httpmock.StringResponse(`{"data":{"viewer":{"login":"octocat"}}}`))
			}
		}

Review comment (suggestion):
This also has to be updated to the new error message.

```suggestion
			wantErr: "no file in the gist",
```

Code after:
					"sample.txt": map[string]interface{}{
						"content":  "data from stdin",
						"filename": "sample.txt",
					},
				},
			},
		},
		{
			name:  "no arguments notty",
			isTTY: false,
			opts: &EditOptions{
				Selector: "",
			},
			wantErr: "gist ID or URL required when not running interactively",
		},
		{
			name: "edit no-file gist (#10626)",
			opts: &EditOptions{
				Selector: "1234",
			},
			mockGist: &shared.Gist{
				ID:    "1234",
				Files: map[string]*shared.GistFile{},
				Owner: &shared.GistOwner{Login: "octocat"},
			},
			wantErr: "no file in the gist",
		},
		{
			name: "edit no-file gist, nil map (#10626)",
			opts: &EditOptions{
				Selector: "1234",
			},
			mockGist: &shared.Gist{
				ID:    "1234",
				Files: nil,
				Owner: &shared.GistOwner{Login: "octocat"},
			},
			wantErr: "no file in the gist",
		},
	}

	for _, tt := range tests {
		reg := &httpmock.Registry{}
		pm := prompter.NewMockPrompter(t)

		if tt.opts == nil {
			tt.opts = &EditOptions{}
		}

		if tt.opts.Selector != "" {
			// Only register the HTTP stubs for a direct gist lookup if a selector is provided.
Repository: cli/cli
File: pkg/cmd/run/shared/presentation.go (Go)

Code before:

		if job.Status == Completed && job.Conclusion == Success {
			continue
		}

		var inProgressStepLine string
		var failedStepLines []string

		for _, step := range job.Steps {
			stepSymbol, stepSymColor := Symbol(cs, step.Status, step.Conclusion)
			stepLine := fmt.Sprintf("  %s %s", stepSymColor(stepSymbol), step.Name)

			if IsFailureState(step.Conclusion) {
				failedStepLines = append(failedStepLines, stepLine)
			}

			if step.Status == InProgress {
				inProgressStepLine = stepLine
			}
		}

		lines = append(lines, failedStepLines...)

		if job.Status == InProgress {
			lines = append(lines, inProgressStepLine)
		}
	}

	return strings.Join(lines, "\n")
}

func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) string {
	lines := []string{}

	for _, a := range annotations {
		lines = append(lines, fmt.Sprintf("%s %s", AnnotationSymbol(cs, a), a.Message))
		// Following newline is essential for spacing between annotations
		lines = append(lines, cs.Mutedf("%s: %s#%d\n", a.JobName, a.Path, a.StartLine))
	}

	return strings.Join(lines, "\n")
}


Review comment (suggestion):
I think this `if`-statement is a bit confusing, since we already now the step is still in progress. Instead we should check if `inProgressStepLine` is not empty:

```suggestion
		if inProgressStepLine != "" {
			lines = append(lines, inProgressStepLine)
		}
```

Code after:

		if job.Status == Completed && job.Conclusion == Success {
			continue
		}

		var inProgressStepLine string
		var failedStepLines []string

		for _, step := range job.Steps {
			stepSymbol, stepSymColor := Symbol(cs, step.Status, step.Conclusion)
			stepLine := fmt.Sprintf("  %s %s", stepSymColor(stepSymbol), step.Name)

			if IsFailureState(step.Conclusion) {
				failedStepLines = append(failedStepLines, stepLine)
			}

			if step.Status == InProgress {
				inProgressStepLine = stepLine
			}
		}

		lines = append(lines, failedStepLines...)

		if inProgressStepLine != "" {
			lines = append(lines, inProgressStepLine)
		}
	}

	return strings.Join(lines, "\n")
}

func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) string {
	lines := []string{}

	for _, a := range annotations {
		lines = append(lines, fmt.Sprintf("%s %s", AnnotationSymbol(cs, a), a.Message))
		// Following newline is essential for spacing between annotations
		lines = append(lines, cs.Mutedf("%s: %s#%d\n", a.JobName, a.Path, a.StartLine))
	}

	return strings.Join(lines, "\n")
}
Repository: cli/cli
File: pkg/cmd/run/watch/watch.go (Go)

Code before:
			$ gh run watch && notify-send 'run is done!'

			# Watch a run in compact mode
			$ gh run watch --compact
		`),
		RunE: func(cmd *cobra.Command, args []string) error {
			// support `-R, --repo` override
			opts.BaseRepo = f.BaseRepo

			if len(args) > 0 {
				opts.RunID = args[0]
			} else if !opts.IO.CanPrompt() {
				return cmdutil.FlagErrorf("run ID required when not running interactively")
			} else {
				opts.Prompt = true
			}

			if runF != nil {
				return runF(opts)
			}

			return watchRun(opts)
		},
	}
	cmd.Flags().BoolVar(&opts.ExitStatus, "exit-status", false, "Exit with non-zero status if run fails")
	cmd.Flags().BoolVar(&opts.Compact, "compact", false, "Enable compact mode")
	cmd.Flags().IntVarP(&opts.Interval, "interval", "i", defaultInterval, "Refresh interval in seconds")

	return cmd
}

func watchRun(opts *WatchOptions) error {
	c, err := opts.HttpClient()
	if err != nil {
		return fmt.Errorf("failed to create http client: %w", err)
	}
	client := api.NewClientFromHTTP(c)

	repo, err := opts.BaseRepo()
	if err != nil {
		return fmt.Errorf("failed to determine base repo: %w", err)
	}

	cs := opts.IO.ColorScheme()

	runID := opts.RunID
	var run *shared.Run

	if opts.Prompt {
		runs, err := shared.GetRunsWithFilter(client, repo, nil, 10, func(run shared.Run) bool {
			return run.Status != shared.Completed

Review comment (bug):
The description should be a bit more:


```suggestion
	cmd.Flags().BoolVar(&opts.Compact, "compact", false, "Show only relevant/failed steps")
```

Code after:
		`),
		RunE: func(cmd *cobra.Command, args []string) error {
			// support `-R, --repo` override
			opts.BaseRepo = f.BaseRepo

			if len(args) > 0 {
				opts.RunID = args[0]
			} else if !opts.IO.CanPrompt() {
				return cmdutil.FlagErrorf("run ID required when not running interactively")
			} else {
				opts.Prompt = true
			}

			if runF != nil {
				return runF(opts)
			}

			return watchRun(opts)
		},
	}
	cmd.Flags().BoolVar(&opts.ExitStatus, "exit-status", false, "Exit with non-zero status if run fails")
	cmd.Flags().BoolVar(&opts.Compact, "compact", false, "Show only relevant/failed steps")
	cmd.Flags().IntVarP(&opts.Interval, "interval", "i", defaultInterval, "Refresh interval in seconds")

	return cmd
}

func watchRun(opts *WatchOptions) error {
	c, err := opts.HttpClient()
	if err != nil {
		return fmt.Errorf("failed to create http client: %w", err)
	}
	client := api.NewClientFromHTTP(c)

	repo, err := opts.BaseRepo()
	if err != nil {
		return fmt.Errorf("failed to determine base repo: %w", err)
	}

	cs := opts.IO.ColorScheme()

	runID := opts.RunID
	var run *shared.Run

	if opts.Prompt {
		runs, err := shared.GetRunsWithFilter(client, repo, nil, 10, func(run shared.Run) bool {
			return run.Status != shared.Completed
		})
		if err != nil {
			return fmt.Errorf("failed to get runs: %w", err)
		}
Repository: cli/cli
File: pkg/cmd/run/watch/watch.go (Go)

Code before:
			}

			missingAnnotationsPermissions = true
			break
		}

		annotations = append(annotations, as...)

		if job.Status != shared.InProgress {
			annotationCache[job.ID] = annotations
		}
	}

	fmt.Fprintln(out, shared.RenderRunHeader(cs, *run, text.FuzzyAgo(opts.Now(), run.StartedTime()), prNumber, 0))
	fmt.Fprintln(out)

	if len(jobs) == 0 {
		return run, nil
	}

	fmt.Fprintln(out, cs.Bold("JOBS"))
	if opts.Compact {
		fmt.Fprintln(out, shared.RenderJobsInCompactMode(cs, jobs))
	} else {
		verbose := true
		fmt.Fprintln(out, shared.RenderJobs(cs, jobs, verbose))
	}

	if missingAnnotationsPermissions {
		fmt.Fprintln(out)
		fmt.Fprintln(out, cs.Bold("ANNOTATIONS"))
		fmt.Fprintf(out, "requesting annotations returned 403 Forbidden as the token does not have sufficient permissions. Note that it is not currently possible to create a fine-grained PAT with the `checks:read` permission.")
	} else if len(annotations) > 0 {
		fmt.Fprintln(out)
		fmt.Fprintln(out, cs.Bold("ANNOTATIONS"))
		fmt.Fprintln(out, shared.RenderAnnotations(cs, annotations))
	}

	return run, nil
}


Review comment (suggestion):
Temp var `verbose` is redundant here.

```suggestion
		fmt.Fprintln(out, shared.RenderJobs(cs, jobs, true))
```

Code after:
		}

		annotations = append(annotations, as...)

		if job.Status != shared.InProgress {
			annotationCache[job.ID] = annotations
		}
	}

	fmt.Fprintln(out, shared.RenderRunHeader(cs, *run, text.FuzzyAgo(opts.Now(), run.StartedTime()), prNumber, 0))
	fmt.Fprintln(out)

	if len(jobs) == 0 {
		return run, nil
	}

	fmt.Fprintln(out, cs.Bold("JOBS"))
	if opts.Compact {
		fmt.Fprintln(out, shared.RenderJobsCompact(cs, jobs))
	} else {
		fmt.Fprintln(out, shared.RenderJobs(cs, jobs, true))
	}

	if missingAnnotationsPermissions {
		fmt.Fprintln(out)
		fmt.Fprintln(out, cs.Bold("ANNOTATIONS"))
		fmt.Fprintf(out, "requesting annotations returned 403 Forbidden as the token does not have sufficient permissions. Note that it is not currently possible to create a fine-grained PAT with the `checks:read` permission.")
	} else if len(annotations) > 0 {
		fmt.Fprintln(out)
		fmt.Fprintln(out, cs.Bold("ANNOTATIONS"))
		fmt.Fprintln(out, shared.RenderAnnotations(cs, annotations))
	}

	return run, nil
}
Repository: cli/cli
File: pkg/cmd/pr/status/status.go (Go)

Code before:
			}

			if pr.BaseRef.BranchProtectionRule.RequiresStrictStatusChecks {
				switch pr.MergeStateStatus {
				case "BEHIND":
					fmt.Fprintf(w, " %s", cs.Yellow("- Not up to date"))
				case "UNKNOWN", "DIRTY":
					// do not print anything
				default:
					fmt.Fprintf(w, " %s", cs.Green("✓ Up to date"))
				}
			}

			if pr.AutoMergeRequest != nil {
				fmt.Fprintf(w, " %s", cs.Green("✓ Auto-merge enabled"))
			}

		} else {
			fmt.Fprintf(w, " - %s", shared.StateTitleWithColor(cs, pr))
		}

		fmt.Fprint(w, "\n")
	}
	remaining := totalCount - len(prs)
	if remaining > 0 {
		fmt.Fprintf(w, cs.Muted("  And %d more\n"), remaining)
	}
}


Review comment (security):
How about using `Mutedf` and `Fprintln`? One small difference is that `\n` will be out of the muted formatting, so the color-reset escape code happens at the same line and the new line starts clean.

```suggestion
		fmt.Fprintln(w, cs.Mutedf("  And %d more", remaining))
```

Code after:
			}

			if pr.BaseRef.BranchProtectionRule.RequiresStrictStatusChecks {
				switch pr.MergeStateStatus {
				case "BEHIND":
					fmt.Fprintf(w, " %s", cs.Yellow("- Not up to date"))
				case "UNKNOWN", "DIRTY":
					// do not print anything
				default:
					fmt.Fprintf(w, " %s", cs.Green("✓ Up to date"))
				}
			}

			if pr.AutoMergeRequest != nil {
				fmt.Fprintf(w, " %s", cs.Green("✓ Auto-merge enabled"))
			}

		} else {
			fmt.Fprintf(w, " - %s", shared.StateTitleWithColor(cs, pr))
		}

		fmt.Fprint(w, "\n")
	}
	remaining := totalCount - len(prs)
	if remaining > 0 {
		fmt.Fprintln(w, cs.Mutedf("  And %d more", remaining))
	}
}
Repository: cli/cli
File: pkg/cmd/release/view/view.go (Go)

Code before:

	if opts.IO.IsStdoutTTY() {
		if err := renderReleaseTTY(opts.IO, release); err != nil {
			return err
		}
	} else {
		if err := renderReleasePlain(opts.IO.Out, release); err != nil {
			return err
		}
	}

	return nil
}

func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
	cs := io.ColorScheme()
	w := io.Out

	fmt.Fprintf(w, "%s\n", cs.Bold(release.TagName))
	if release.IsDraft {
		fmt.Fprintf(w, "%s • ", cs.Red("Draft"))
	} else if release.IsPrerelease {
		fmt.Fprintf(w, "%s • ", cs.Yellow("Pre-release"))
	}
	if release.IsDraft {
		fmt.Fprintf(w, "%s\n", cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
	} else {
		fmt.Fprintf(w, "%s\n", cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
	}

	renderedDescription, err := markdown.Render(release.Body,
		markdown.WithTheme(io.TerminalTheme()),
		markdown.WithWrap(io.TerminalWidth()))
	if err != nil {
		return err
	}
	fmt.Fprintln(w, renderedDescription)

	if len(release.Assets) > 0 {
		fmt.Fprintf(w, "%s\n", cs.Bold("Assets"))
		//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
		table := tableprinter.New(io, tableprinter.NoHeader)
		for _, a := range release.Assets {
			table.AddField(a.Name)
			table.AddField(humanFileSize(a.Size))
			table.EndRow()
		}
		err := table.Render()
		if err != nil {
			return err
		}

Review comment (security):
```suggestion
		fmt.Fprintln(w, cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
```

Code after:

	if opts.IO.IsStdoutTTY() {
		if err := renderReleaseTTY(opts.IO, release); err != nil {
			return err
		}
	} else {
		if err := renderReleasePlain(opts.IO.Out, release); err != nil {
			return err
		}
	}

	return nil
}

func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
	cs := io.ColorScheme()
	w := io.Out

	fmt.Fprintf(w, "%s\n", cs.Bold(release.TagName))
	if release.IsDraft {
		fmt.Fprintf(w, "%s • ", cs.Red("Draft"))
	} else if release.IsPrerelease {
		fmt.Fprintf(w, "%s • ", cs.Yellow("Pre-release"))
	}
	if release.IsDraft {
		fmt.Fprintln(w, cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
	} else {
		fmt.Fprintln(w, cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
	}

	renderedDescription, err := markdown.Render(release.Body,
		markdown.WithTheme(io.TerminalTheme()),
		markdown.WithWrap(io.TerminalWidth()))
	if err != nil {
		return err
	}
	fmt.Fprintln(w, renderedDescription)

	if len(release.Assets) > 0 {
		fmt.Fprintln(w, cs.Bold("Assets"))
		//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
		table := tableprinter.New(io, tableprinter.NoHeader)
		for _, a := range release.Assets {
			table.AddField(a.Name)
			table.AddField(humanFileSize(a.Size))
			table.EndRow()
		}
		err := table.Render()
		if err != nil {
			return err
		}
Repository: cli/cli
File: pkg/cmd/release/view/view.go (Go)

Code before:
		if err := renderReleaseTTY(opts.IO, release); err != nil {
			return err
		}
	} else {
		if err := renderReleasePlain(opts.IO.Out, release); err != nil {
			return err
		}
	}

	return nil
}

func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
	cs := io.ColorScheme()
	w := io.Out

	fmt.Fprintf(w, "%s\n", cs.Bold(release.TagName))
	if release.IsDraft {
		fmt.Fprintf(w, "%s • ", cs.Red("Draft"))
	} else if release.IsPrerelease {
		fmt.Fprintf(w, "%s • ", cs.Yellow("Pre-release"))
	}
	if release.IsDraft {
		fmt.Fprintf(w, "%s\n", cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
	} else {
		fmt.Fprintf(w, "%s\n", cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
	}

	renderedDescription, err := markdown.Render(release.Body,
		markdown.WithTheme(io.TerminalTheme()),
		markdown.WithWrap(io.TerminalWidth()))
	if err != nil {
		return err
	}
	fmt.Fprintln(w, renderedDescription)

	if len(release.Assets) > 0 {
		fmt.Fprintf(w, "%s\n", cs.Bold("Assets"))
		//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
		table := tableprinter.New(io, tableprinter.NoHeader)
		for _, a := range release.Assets {
			table.AddField(a.Name)
			table.AddField(humanFileSize(a.Size))
			table.EndRow()
		}
		err := table.Render()
		if err != nil {
			return err
		}
		fmt.Fprint(w, "\n")
	}

Review comment (security):
```suggestion
		fmt.Fprintln(w, cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
```

Code after:
		if err := renderReleaseTTY(opts.IO, release); err != nil {
			return err
		}
	} else {
		if err := renderReleasePlain(opts.IO.Out, release); err != nil {
			return err
		}
	}

	return nil
}

func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {
	cs := io.ColorScheme()
	w := io.Out

	fmt.Fprintf(w, "%s\n", cs.Bold(release.TagName))
	if release.IsDraft {
		fmt.Fprintf(w, "%s • ", cs.Red("Draft"))
	} else if release.IsPrerelease {
		fmt.Fprintf(w, "%s • ", cs.Yellow("Pre-release"))
	}
	if release.IsDraft {
		fmt.Fprintln(w, cs.Mutedf("%s created this %s", release.Author.Login, text.FuzzyAgo(time.Now(), release.CreatedAt)))
	} else {
		fmt.Fprintln(w, cs.Mutedf("%s released this %s", release.Author.Login, text.FuzzyAgo(time.Now(), *release.PublishedAt)))
	}

	renderedDescription, err := markdown.Render(release.Body,
		markdown.WithTheme(io.TerminalTheme()),
		markdown.WithWrap(io.TerminalWidth()))
	if err != nil {
		return err
	}
	fmt.Fprintln(w, renderedDescription)

	if len(release.Assets) > 0 {
		fmt.Fprintln(w, cs.Bold("Assets"))
		//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
		table := tableprinter.New(io, tableprinter.NoHeader)
		for _, a := range release.Assets {
			table.AddField(a.Name)
			table.AddField(humanFileSize(a.Size))
			table.EndRow()
		}
		err := table.Render()
		if err != nil {
			return err
		}
		fmt.Fprint(w, "\n")
	}
Repository: cli/cli
File: pkg/cmd/preview/prompter/prompter.go (Go)

Code before:
					}
					opts.PromptsToRun = append(opts.PromptsToRun, f)
				}
			}

			return prompterRun(opts)
		},
	}

	return cmd
}

func prompterRun(opts *prompterOptions) error {
	editor, err := cmdutil.DetermineEditor(opts.Config)
	if err != nil {
		return err
	}

	p := prompter.New(editor, opts.IO.In, opts.IO.Out, opts.IO.ErrOut)

	for _, f := range opts.PromptsToRun {
		if err := f(p); err != nil {
			return err
		}
		// Newline for readability
		fmt.Println()
	}

	return nil
}

func runSelect(p prompter.Prompter) error {
	fmt.Println("Demonstrating Single Select")
	cuisines := []string{"Italian", "Greek", "Indian", "Japanese", "American"}
	favorite, err := p.Select("Favorite cuisine?", "Italian", cuisines)
	if err != nil {
		return err
	}
	fmt.Printf("Favorite cuisine: %s\n", cuisines[favorite])
	return nil
}

func runMultiSelect(p prompter.Prompter) error {
	fmt.Println("Demonstrating Multi Select")
	cuisines := []string{"Italian", "Greek", "Indian", "Japanese", "American"}
	favorites, err := p.MultiSelect("Favorite cuisines?", []string{}, cuisines)
	if err != nil {
		return err
	}
	for _, f := range favorites {
		fmt.Printf("Favorite cuisine: %s\n", cuisines[f])

Review comment (suggestion):
@BagToad raised a good point about this section here on how this introduces whitespace that isn't done within the actual `gh` experience and something we possibly should remove.

I agree as any pain points we have with our experience should be present as well as any fixes we make to the experience.

Code after:
					}
					opts.PromptsToRun = append(opts.PromptsToRun, f)
				}
			}

			return prompterRun(opts)
		},
	}

	return cmd
}

func prompterRun(opts *prompterOptions) error {
	editor, err := cmdutil.DetermineEditor(opts.Config)
	if err != nil {
		return err
	}

	p := prompter.New(editor, opts.IO)

	for _, f := range opts.PromptsToRun {
		if err := f(p, opts.IO); err != nil {
			return err
		}
	}

	return nil
}

func runSelect(p prompter.Prompter, io *iostreams.IOStreams) error {
	fmt.Fprintln(io.Out, "Demonstrating Single Select")
	cuisines := []string{"Italian", "Greek", "Indian", "Japanese", "American"}
	favorite, err := p.Select("Favorite cuisine?", "Italian", cuisines)
	if err != nil {
		return err
	}
	fmt.Fprintf(io.Out, "Favorite cuisine: %s\n", cuisines[favorite])
	return nil
}

func runMultiSelect(p prompter.Prompter, io *iostreams.IOStreams) error {
	fmt.Fprintln(io.Out, "Demonstrating Multi Select")
	cuisines := []string{"Italian", "Greek", "Indian", "Japanese", "American"}
	favorites, err := p.MultiSelect("Favorite cuisines?", []string{}, cuisines)
	if err != nil {
		return err
	}
	for _, f := range favorites {
		fmt.Fprintf(io.Out, "Favorite cuisine: %s\n", cuisines[f])
	}
	return nil
Repository: cli/cli
File: pkg/cmd/attestation/test/data/data.go (Go)

Code before:
package data

import (
	_ "embed"
	"testing"

	"github.com/sigstore/sigstore-go/pkg/bundle"
	sgData "github.com/sigstore/sigstore-go/pkg/testing/data"
)

//go:embed sigstore-js-2.1.0-bundle.json
var SigstoreBundleRaw []byte

// SigstoreBundle returns a test *sigstore.Bundle
func SigstoreBundle(t *testing.T) *bundle.Bundle {
	return sgData.TestBundle(t, SigstoreBundleRaw)
}


Review comment (bug):
The `TestBundle` function was removed from the newest release of sigstore-go, which was causing the failing CI jobs on the dependabot PR. I replaced it with a new function that does the same thing it was doing under the hood.

Code after:
package data

import (
	_ "embed"
	"testing"

	"github.com/sigstore/sigstore-go/pkg/bundle"
)

//go:embed sigstore-js-2.1.0-bundle.json
var SigstoreBundleRaw []byte

// SigstoreBundle returns a test sigstore-go bundle.Bundle
func SigstoreBundle(t *testing.T) *bundle.Bundle {
	b := &bundle.Bundle{}
	err := b.UnmarshalJSON(SigstoreBundleRaw)
	if err != nil {
		t.Fatalf("failed to unmarshal sigstore bundle: %v", err)
	}
	return b
}