fix golint failures of cmd/kube-proxy/app

This commit is contained in:
SataQiu
2019-04-13 01:21:28 +08:00
parent ed2bdd53dc
commit cc199c74fc
3 changed files with 7 additions and 4 deletions

View File

@@ -196,6 +196,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
"Options are:\n"+strings.Join(utilfeature.DefaultFeatureGate.KnownFeatures(), "\n"))
}
// NewOptions returns initialized Options
func NewOptions() *Options {
return &Options{
config: new(kubeproxyconfig.KubeProxyConfiguration),
@@ -218,11 +219,11 @@ func (o *Options) Complete() error {
// Load the config file here in Complete, so that Validate validates the fully-resolved config.
if len(o.ConfigFile) > 0 {
if c, err := o.loadConfigFromFile(o.ConfigFile); err != nil {
c, err := o.loadConfigFromFile(o.ConfigFile)
if err != nil {
return err
} else {
o.config = c
}
o.config = c
if err := o.initWatcher(); err != nil {
return err
@@ -295,6 +296,7 @@ func (o *Options) Validate(args []string) error {
return nil
}
// Run runs the specified ProxyServer.
func (o *Options) Run() error {
defer close(o.errCh)
if len(o.WriteConfigTo) > 0 {
@@ -415,6 +417,7 @@ func (o *Options) loadConfig(data []byte) (*kubeproxyconfig.KubeProxyConfigurati
return proxyConfig, nil
}
// ApplyDefaults applies the default values to Options.
func (o *Options) ApplyDefaults(in *kubeproxyconfig.KubeProxyConfiguration) (*kubeproxyconfig.KubeProxyConfiguration, error) {
external, err := o.scheme.ConvertToVersion(in, v1alpha1.SchemeGroupVersion)
if err != nil {

View File

@@ -24,6 +24,7 @@ import (
"errors"
"fmt"
"net"
// Enable pprof HTTP handlers.
_ "net/http/pprof"
"k8s.io/api/core/v1"