Skip to content

Commit 6f7690e

Browse files
committed
fix some golint failures of pkg/kubectl/cmd/attach pkg/kubectl/cmd/autoscale
1 parent 1c5eed4 commit 6f7690e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pkg/kubectl/cmd/attach/attach.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const (
6161
defaultPodLogsTimeout = 20 * time.Second
6262
)
6363

64-
// AttachOptions declare the arguments accepted by the Exec command
64+
// AttachOptions declare the arguments accepted by the Attach command
6565
type AttachOptions struct {
6666
exec.StreamOptions
6767

@@ -84,6 +84,7 @@ type AttachOptions struct {
8484
Config *restclient.Config
8585
}
8686

87+
// NewAttachOptions creates the options for attach
8788
func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions {
8889
return &AttachOptions{
8990
StreamOptions: exec.StreamOptions{
@@ -94,6 +95,7 @@ func NewAttachOptions(streams genericclioptions.IOStreams) *AttachOptions {
9495
}
9596
}
9697

98+
// NewCmdAttach returns the attach Cobra command
9799
func NewCmdAttach(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
98100
o := NewAttachOptions(streams)
99101
cmd := &cobra.Command{
@@ -120,6 +122,7 @@ type RemoteAttach interface {
120122
Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error
121123
}
122124

125+
// DefaultAttachFunc is the default AttachFunc used
123126
func DefaultAttachFunc(o *AttachOptions, containerToAttach *corev1.Container, raw bool, sizeQueue remotecommand.TerminalSizeQueue) func() error {
124127
return func() error {
125128
restClient, err := restclient.RESTClientFor(o.Config)
@@ -146,6 +149,7 @@ func DefaultAttachFunc(o *AttachOptions, containerToAttach *corev1.Container, ra
146149
// DefaultRemoteAttach is the standard implementation of attaching
147150
type DefaultRemoteAttach struct{}
148151

152+
// Attach executes attach to a running container
149153
func (*DefaultRemoteAttach) Attach(method string, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool, terminalSizeQueue remotecommand.TerminalSizeQueue) error {
150154
exec, err := remotecommand.NewSPDYExecutor(config, method, url)
151155
if err != nil {

pkg/kubectl/cmd/autoscale/autoscale.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var (
5353
kubectl autoscale rc foo --max=5 --cpu-percent=80`))
5454
)
5555

56+
// AutoscaleOptions declare the arguments accepted by the Autoscale command
5657
type AutoscaleOptions struct {
5758
FilenameOptions *resource.FilenameOptions
5859

@@ -82,6 +83,7 @@ type AutoscaleOptions struct {
8283
genericclioptions.IOStreams
8384
}
8485

86+
// NewAutoscaleOptions creates the options for autoscale
8587
func NewAutoscaleOptions(ioStreams genericclioptions.IOStreams) *AutoscaleOptions {
8688
return &AutoscaleOptions{
8789
PrintFlags: genericclioptions.NewPrintFlags("autoscaled").WithTypeSetter(scheme.Scheme),
@@ -93,6 +95,7 @@ func NewAutoscaleOptions(ioStreams genericclioptions.IOStreams) *AutoscaleOption
9395
}
9496
}
9597

98+
// NewCmdAutoscale returns the autoscale Cobra command
9699
func NewCmdAutoscale(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {
97100
o := NewAutoscaleOptions(ioStreams)
98101

@@ -128,6 +131,7 @@ func NewCmdAutoscale(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *
128131
return cmd
129132
}
130133

134+
// Complete verifies command line arguments and loads data from the command environment
131135
func (o *AutoscaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
132136
var err error
133137
o.dryRun = cmdutil.GetFlagBool(cmd, "dry-run")
@@ -187,6 +191,7 @@ func (o *AutoscaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args
187191
return nil
188192
}
189193

194+
// Validate checks that the provided attach options are specified.
190195
func (o *AutoscaleOptions) Validate() error {
191196
if o.Max < 1 {
192197
return fmt.Errorf("--max=MAXPODS is required and must be at least 1, max: %d", o.Max)
@@ -198,6 +203,7 @@ func (o *AutoscaleOptions) Validate() error {
198203
return nil
199204
}
200205

206+
// Run performs the execution
201207
func (o *AutoscaleOptions) Run() error {
202208
r := o.builder.
203209
Unstructured().

0 commit comments

Comments
 (0)