Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d413e3f1
Commit
d413e3f1
authored
May 05, 2019
by
SataQiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix golint failures of pkg/kubectl/cmd/help pkg/kubectl/cmd/proxy pkg/kubectl/cmd/util/openapi
parent
43ce2f17
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
4 deletions
+7
-4
.golint_failures
hack/.golint_failures
+0
-3
help.go
pkg/kubectl/cmd/help/help.go
+3
-1
proxy.go
pkg/kubectl/cmd/proxy/proxy.go
+2
-0
extensions.go
pkg/kubectl/cmd/util/openapi/extensions.go
+1
-0
openapi.go
pkg/kubectl/cmd/util/openapi/openapi.go
+1
-0
No files found.
hack/.golint_failures
View file @
d413e3f1
...
@@ -131,13 +131,11 @@ pkg/kubectl/cmd/exec
...
@@ -131,13 +131,11 @@ pkg/kubectl/cmd/exec
pkg/kubectl/cmd/explain
pkg/kubectl/cmd/explain
pkg/kubectl/cmd/expose
pkg/kubectl/cmd/expose
pkg/kubectl/cmd/get
pkg/kubectl/cmd/get
pkg/kubectl/cmd/help
pkg/kubectl/cmd/label
pkg/kubectl/cmd/label
pkg/kubectl/cmd/logs
pkg/kubectl/cmd/logs
pkg/kubectl/cmd/patch
pkg/kubectl/cmd/patch
pkg/kubectl/cmd/plugin
pkg/kubectl/cmd/plugin
pkg/kubectl/cmd/portforward
pkg/kubectl/cmd/portforward
pkg/kubectl/cmd/proxy
pkg/kubectl/cmd/replace
pkg/kubectl/cmd/replace
pkg/kubectl/cmd/rollingupdate
pkg/kubectl/cmd/rollingupdate
pkg/kubectl/cmd/rollout
pkg/kubectl/cmd/rollout
...
@@ -148,7 +146,6 @@ pkg/kubectl/cmd/taint
...
@@ -148,7 +146,6 @@ pkg/kubectl/cmd/taint
pkg/kubectl/cmd/testing
pkg/kubectl/cmd/testing
pkg/kubectl/cmd/top
pkg/kubectl/cmd/top
pkg/kubectl/cmd/util
pkg/kubectl/cmd/util
pkg/kubectl/cmd/util/openapi
pkg/kubectl/cmd/wait
pkg/kubectl/cmd/wait
pkg/kubectl/describe/versioned
pkg/kubectl/describe/versioned
pkg/kubectl/generate
pkg/kubectl/generate
...
...
pkg/kubectl/cmd/help/help.go
View file @
d413e3f1
...
@@ -29,6 +29,7 @@ var helpLong = templates.LongDesc(i18n.T(`
...
@@ -29,6 +29,7 @@ var helpLong = templates.LongDesc(i18n.T(`
Help provides help for any command in the application.
Help provides help for any command in the application.
Simply type kubectl help [path to command] for full details.`
))
Simply type kubectl help [path to command] for full details.`
))
// NewCmdHelp returns the help Cobra command
func
NewCmdHelp
()
*
cobra
.
Command
{
func
NewCmdHelp
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"help [command] | STRING_TO_SEARCH"
,
Use
:
"help [command] | STRING_TO_SEARCH"
,
...
@@ -42,6 +43,7 @@ func NewCmdHelp() *cobra.Command {
...
@@ -42,6 +43,7 @@ func NewCmdHelp() *cobra.Command {
return
cmd
return
cmd
}
}
// RunHelp checks given arguments and executes command
func
RunHelp
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
RunHelp
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
foundCmd
,
_
,
err
:=
cmd
.
Root
()
.
Find
(
args
)
foundCmd
,
_
,
err
:=
cmd
.
Root
()
.
Find
(
args
)
...
@@ -56,7 +58,7 @@ func RunHelp(cmd *cobra.Command, args []string) {
...
@@ -56,7 +58,7 @@ func RunHelp(cmd *cobra.Command, args []string) {
cmd
.
Println
(
err
)
cmd
.
Println
(
err
)
argsString
:=
strings
.
Join
(
args
,
" "
)
argsString
:=
strings
.
Join
(
args
,
" "
)
var
matchedMsgIsPrinted
bool
=
false
var
matchedMsgIsPrinted
=
false
for
_
,
foundCmd
:=
range
foundCmd
.
Commands
()
{
for
_
,
foundCmd
:=
range
foundCmd
.
Commands
()
{
if
strings
.
Contains
(
foundCmd
.
Short
,
argsString
)
{
if
strings
.
Contains
(
foundCmd
.
Short
,
argsString
)
{
if
!
matchedMsgIsPrinted
{
if
!
matchedMsgIsPrinted
{
...
...
pkg/kubectl/cmd/proxy/proxy.go
View file @
d413e3f1
...
@@ -70,6 +70,7 @@ var (
...
@@ -70,6 +70,7 @@ var (
kubectl proxy --api-prefix=/k8s-api`
))
kubectl proxy --api-prefix=/k8s-api`
))
)
)
// NewCmdProxy returns the proxy Cobra command
func
NewCmdProxy
(
f
cmdutil
.
Factory
,
streams
genericclioptions
.
IOStreams
)
*
cobra
.
Command
{
func
NewCmdProxy
(
f
cmdutil
.
Factory
,
streams
genericclioptions
.
IOStreams
)
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]"
,
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.
...
@@ -97,6 +98,7 @@ func NewCmdProxy(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.
return
cmd
return
cmd
}
}
// RunProxy checks given arguments and executes command
func
RunProxy
(
f
cmdutil
.
Factory
,
out
io
.
Writer
,
cmd
*
cobra
.
Command
)
error
{
func
RunProxy
(
f
cmdutil
.
Factory
,
out
io
.
Writer
,
cmd
*
cobra
.
Command
)
error
{
path
:=
cmdutil
.
GetFlagString
(
cmd
,
"unix-socket"
)
path
:=
cmdutil
.
GetFlagString
(
cmd
,
"unix-socket"
)
port
:=
cmdutil
.
GetFlagInt
(
cmd
,
"port"
)
port
:=
cmdutil
.
GetFlagInt
(
cmd
,
"port"
)
...
...
pkg/kubectl/cmd/util/openapi/extensions.go
View file @
d413e3f1
...
@@ -18,6 +18,7 @@ package openapi
...
@@ -18,6 +18,7 @@ package openapi
import
"github.com/go-openapi/spec"
import
"github.com/go-openapi/spec"
// PrintColumnsKey is the key that defines which columns should be printed
const
PrintColumnsKey
=
"x-kubernetes-print-columns"
const
PrintColumnsKey
=
"x-kubernetes-print-columns"
// GetPrintColumns looks for the open API extension for the display columns.
// GetPrintColumns looks for the open API extension for the display columns.
...
...
pkg/kubectl/cmd/util/openapi/openapi.go
View file @
d413e3f1
...
@@ -44,6 +44,7 @@ type document struct {
...
@@ -44,6 +44,7 @@ type document struct {
var
_
Resources
=
&
document
{}
var
_
Resources
=
&
document
{}
// NewOpenAPIData creates a new `Resources` out of the openapi document
func
NewOpenAPIData
(
doc
*
openapi_v2
.
Document
)
(
Resources
,
error
)
{
func
NewOpenAPIData
(
doc
*
openapi_v2
.
Document
)
(
Resources
,
error
)
{
models
,
err
:=
proto
.
NewOpenAPIData
(
doc
)
models
,
err
:=
proto
.
NewOpenAPIData
(
doc
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment