Skip to content

Commit d413e3f

Browse files
committed
fix golint failures of pkg/kubectl/cmd/help pkg/kubectl/cmd/proxy pkg/kubectl/cmd/util/openapi
1 parent 43ce2f1 commit d413e3f

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

hack/.golint_failures

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,11 @@ pkg/kubectl/cmd/exec
131131
pkg/kubectl/cmd/explain
132132
pkg/kubectl/cmd/expose
133133
pkg/kubectl/cmd/get
134-
pkg/kubectl/cmd/help
135134
pkg/kubectl/cmd/label
136135
pkg/kubectl/cmd/logs
137136
pkg/kubectl/cmd/patch
138137
pkg/kubectl/cmd/plugin
139138
pkg/kubectl/cmd/portforward
140-
pkg/kubectl/cmd/proxy
141139
pkg/kubectl/cmd/replace
142140
pkg/kubectl/cmd/rollingupdate
143141
pkg/kubectl/cmd/rollout
@@ -148,7 +146,6 @@ pkg/kubectl/cmd/taint
148146
pkg/kubectl/cmd/testing
149147
pkg/kubectl/cmd/top
150148
pkg/kubectl/cmd/util
151-
pkg/kubectl/cmd/util/openapi
152149
pkg/kubectl/cmd/wait
153150
pkg/kubectl/describe/versioned
154151
pkg/kubectl/generate

pkg/kubectl/cmd/help/help.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var helpLong = templates.LongDesc(i18n.T(`
2929
Help provides help for any command in the application.
3030
Simply type kubectl help [path to command] for full details.`))
3131

32+
// NewCmdHelp returns the help Cobra command
3233
func NewCmdHelp() *cobra.Command {
3334
cmd := &cobra.Command{
3435
Use: "help [command] | STRING_TO_SEARCH",
@@ -42,6 +43,7 @@ func NewCmdHelp() *cobra.Command {
4243
return cmd
4344
}
4445

46+
// RunHelp checks given arguments and executes command
4547
func RunHelp(cmd *cobra.Command, args []string) {
4648
foundCmd, _, err := cmd.Root().Find(args)
4749

@@ -56,7 +58,7 @@ func RunHelp(cmd *cobra.Command, args []string) {
5658
cmd.Println(err)
5759

5860
argsString := strings.Join(args, " ")
59-
var matchedMsgIsPrinted bool = false
61+
var matchedMsgIsPrinted = false
6062
for _, foundCmd := range foundCmd.Commands() {
6163
if strings.Contains(foundCmd.Short, argsString) {
6264
if !matchedMsgIsPrinted {

pkg/kubectl/cmd/proxy/proxy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var (
7070
kubectl proxy --api-prefix=/k8s-api`))
7171
)
7272

73+
// NewCmdProxy returns the proxy Cobra command
7374
func NewCmdProxy(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
7475
cmd := &cobra.Command{
7576
Use: "proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]",
@@ -97,6 +98,7 @@ func NewCmdProxy(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.
9798
return cmd
9899
}
99100

101+
// RunProxy checks given arguments and executes command
100102
func RunProxy(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
101103
path := cmdutil.GetFlagString(cmd, "unix-socket")
102104
port := cmdutil.GetFlagInt(cmd, "port")

pkg/kubectl/cmd/util/openapi/extensions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package openapi
1818

1919
import "github.com/go-openapi/spec"
2020

21+
// PrintColumnsKey is the key that defines which columns should be printed
2122
const PrintColumnsKey = "x-kubernetes-print-columns"
2223

2324
// GetPrintColumns looks for the open API extension for the display columns.

pkg/kubectl/cmd/util/openapi/openapi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type document struct {
4444

4545
var _ Resources = &document{}
4646

47+
// NewOpenAPIData creates a new `Resources` out of the openapi document
4748
func NewOpenAPIData(doc *openapi_v2.Document) (Resources, error) {
4849
models, err := proto.NewOpenAPIData(doc)
4950
if err != nil {

0 commit comments

Comments
 (0)