Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix golint failures of pkg/kubectl/cmd/help pkg/kubectl/cmd/proxy pkg/kubectl/cmd/util/openapi #77471

Merged
merged 1 commit into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,11 @@ pkg/kubectl/cmd/exec
pkg/kubectl/cmd/explain
pkg/kubectl/cmd/expose
pkg/kubectl/cmd/get
pkg/kubectl/cmd/help
pkg/kubectl/cmd/label
pkg/kubectl/cmd/logs
pkg/kubectl/cmd/patch
pkg/kubectl/cmd/plugin
pkg/kubectl/cmd/portforward
pkg/kubectl/cmd/proxy
pkg/kubectl/cmd/replace
pkg/kubectl/cmd/rollingupdate
pkg/kubectl/cmd/rollout
Expand All @@ -148,7 +146,6 @@ pkg/kubectl/cmd/taint
pkg/kubectl/cmd/testing
pkg/kubectl/cmd/top
pkg/kubectl/cmd/util
pkg/kubectl/cmd/util/openapi
pkg/kubectl/cmd/wait
pkg/kubectl/describe/versioned
pkg/kubectl/generate
Expand Down
4 changes: 3 additions & 1 deletion pkg/kubectl/cmd/help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var helpLong = templates.LongDesc(i18n.T(`
Help provides help for any command in the application.
Simply type kubectl help [path to command] for full details.`))

// NewCmdHelp returns the help Cobra command
func NewCmdHelp() *cobra.Command {
cmd := &cobra.Command{
Use: "help [command] | STRING_TO_SEARCH",
Expand All @@ -42,6 +43,7 @@ func NewCmdHelp() *cobra.Command {
return cmd
}

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

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

argsString := strings.Join(args, " ")
var matchedMsgIsPrinted bool = false
var matchedMsgIsPrinted = false
for _, foundCmd := range foundCmd.Commands() {
if strings.Contains(foundCmd.Short, argsString) {
if !matchedMsgIsPrinted {
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubectl/cmd/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var (
kubectl proxy --api-prefix=/k8s-api`))
)

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

// RunProxy checks given arguments and executes command
func RunProxy(f cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
path := cmdutil.GetFlagString(cmd, "unix-socket")
port := cmdutil.GetFlagInt(cmd, "port")
Expand Down
1 change: 1 addition & 0 deletions pkg/kubectl/cmd/util/openapi/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package openapi

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

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

// GetPrintColumns looks for the open API extension for the display columns.
Expand Down
1 change: 1 addition & 0 deletions pkg/kubectl/cmd/util/openapi/openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type document struct {

var _ Resources = &document{}

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