Merge pull request #99892 from changshuchao/last-applied

code cleanup for kubectl apply_edit_last_applied.go ,completion.go,cp.go,wait.go
This commit is contained in:
Kubernetes Prow Robot 2021-04-08 16:00:17 -07:00 committed by GitHub
commit 87e7f749a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 14 deletions

View File

@ -67,12 +67,8 @@ func NewCmdApplyEditLastApplied(f cmdutil.Factory, ioStreams genericclioptions.I
Long: applyEditLastAppliedLong, Long: applyEditLastAppliedLong,
Example: applyEditLastAppliedExample, Example: applyEditLastAppliedExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if err := o.Complete(f, args, cmd); err != nil { cmdutil.CheckErr(o.Complete(f, args, cmd))
cmdutil.CheckErr(err) cmdutil.CheckErr(o.Run())
}
if err := o.Run(); err != nil {
cmdutil.CheckErr(err)
}
}, },
} }

View File

@ -106,8 +106,7 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
Long: completionLong, Long: completionLong,
Example: completionExample, Example: completionExample,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
err := RunCompletion(out, boilerPlate, cmd, args) cmdutil.CheckErr(RunCompletion(out, boilerPlate, cmd, args))
cmdutil.CheckErr(err)
}, },
ValidArgs: shells, ValidArgs: shells,
} }

View File

@ -260,8 +260,7 @@ func (o *CopyOptions) copyToPod(src, dest fileSpec, options *exec.ExecOptions) e
go func() { go func() {
defer writer.Close() defer writer.Close()
err := makeTar(src.File, dest.File, writer) cmdutil.CheckErr(makeTar(src.File, dest.File, writer))
cmdutil.CheckErr(err)
}() }()
var cmdArr []string var cmdArr []string
@ -318,8 +317,7 @@ func (o *CopyOptions) copyFromPod(src, dest fileSpec) error {
go func() { go func() {
defer outStream.Close() defer outStream.Close()
err := o.execute(options) cmdutil.CheckErr(o.execute(options))
cmdutil.CheckErr(err)
}() }()
prefix := getPrefix(src.File) prefix := getPrefix(src.File)
prefix = path.Clean(prefix) prefix = path.Clean(prefix)

View File

@ -120,8 +120,7 @@ func NewCmdWait(restClientGetter genericclioptions.RESTClientGetter, streams gen
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
o, err := flags.ToOptions(args) o, err := flags.ToOptions(args)
cmdutil.CheckErr(err) cmdutil.CheckErr(err)
err = o.RunWait() cmdutil.CheckErr(o.RunWait())
cmdutil.CheckErr(err)
}, },
SuggestFor: []string{"list", "ps"}, SuggestFor: []string{"list", "ps"},
} }