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,
Example: applyEditLastAppliedExample,
Run: func(cmd *cobra.Command, args []string) {
if err := o.Complete(f, args, cmd); err != nil {
cmdutil.CheckErr(err)
}
if err := o.Run(); err != nil {
cmdutil.CheckErr(err)
}
cmdutil.CheckErr(o.Complete(f, args, cmd))
cmdutil.CheckErr(o.Run())
},
}

View File

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

View File

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

View File

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