gendocs: using bytes.NewReader(nil)/ioutil.Discard instead of os input/output to generate command

This commit is contained in:
SataQiu
2021-06-08 11:55:32 +08:00
parent 588d984407
commit aea2e33175
3 changed files with 8 additions and 7 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"os"
@@ -45,7 +46,6 @@ func main() {
// Set environment variables used by kubectl so the output is consistent,
// regardless of where we run.
os.Setenv("HOME", "/home/username")
// TODO os.Stdin should really be something like ioutil.Discard, but a Reader
kubectl := cmd.NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard)
kubectl := cmd.NewKubectlCommand(bytes.NewReader(nil), ioutil.Discard, ioutil.Discard)
doc.GenMarkdownTree(kubectl, outDir)
}