fix(list): `list -o json` and `-o yaml` print nothing when no instances exist

オープン 初心者向け
#953 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
75/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, json, yaml
領域
cli

調査の方向性

cmd/cli/list/list.goから始め、インスタンスが見つからない場合のrun()の早期リターンを追い、その後、formatterがJSONとYAMLの出力をどのように処理するか確認してください。テーブル出力の既存メッセージはそのままにし、空のJSONとYAMLの出力が有効なドキュメントになるようにしてください。issueにあるインスタンスなしの再現手順で確認してください。関連するキャッシュファイルのクリーンアップは別の作業です。

索引モデルが issue の本文から書いたものです。

説明

holodeck list -o json writes 0 bytes to stdout when there are no instances, so holodeck list -o json | jq . fails instead of returning an empty list. -o yaml does the same. run() in cmd/cli/list/list.go returns early with "No instances found" (written to stderr) before it reaches the formatter.

Repro: with no instance caches, holodeck list -o json | wc -c prints 0 (rc=0).

Expected: {"instances":[]} for json and the matching empty document for yaml. The table output keeps its message.

Related, same directory: kubeadmConfigLocalPath (pkg/provisioner/provisioner.go:411) writes kubeadm-config-<env>.yaml into the instance cache ~/.cache/holodeck, and nothing removes those files. A dev machine here holds 30 of them, and ListInstances parses each one as an Environment before it skips it. Write them elsewhere or delete them with the instance.

主要言語
Go
スター
31
フォーク
20
平均マージ
2日 4時間
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/holodeck のほかの issue

NVIDIA/holodeck の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。