mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
fix golint failures of pkg/kubectl/cmd/help pkg/kubectl/cmd/proxy pkg/kubectl/cmd/util/openapi
This commit is contained in:
parent
43ce2f17cf
commit
d413e3f18d
@ -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
|
||||
@ -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
|
||||
|
@ -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",
|
||||
@ -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)
|
||||
|
||||
@ -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 {
|
||||
|
@ -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]",
|
||||
@ -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")
|
||||
|
@ -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.
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user