From 21e4f0039eef049c58a80c83bd4946890343966a Mon Sep 17 00:00:00 2001 From: JieJhih Jhang Date: Fri, 3 May 2019 14:31:51 +0800 Subject: [PATCH] fix golint --- cmd/kube-proxy/app/server.go | 5 +---- pkg/proxy/endpoints.go | 6 +++--- pkg/proxy/service.go | 6 +++--- pkg/proxy/util/network.go | 4 ++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cmd/kube-proxy/app/server.go b/cmd/kube-proxy/app/server.go index 5000e42e80e..4b0fffc3e81 100644 --- a/cmd/kube-proxy/app/server.go +++ b/cmd/kube-proxy/app/server.go @@ -236,10 +236,7 @@ func (o *Options) Complete() error { return err } - if err := utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates); err != nil { - return err - } - return nil + return utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates) } // Creates a new filesystem watcher and adds watches for the config file. diff --git a/pkg/proxy/endpoints.go b/pkg/proxy/endpoints.go index 21f10cdcbf4..713f7e17ebe 100644 --- a/pkg/proxy/endpoints.go +++ b/pkg/proxy/endpoints.go @@ -282,7 +282,7 @@ func (ect *EndpointChangeTracker) endpointsToEndpointsMap(endpoints *v1.Endpoint // The changes map is cleared after applying them. // In addition it returns (via argument) and resets the lastChangeTriggerTimes for all endpoints // that were changed and will result in syncing the proxy rules. -func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint, +func (em EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint, staleServiceNames *[]ServicePortName, lastChangeTriggerTimes *[]time.Time) { if changes == nil { return @@ -290,8 +290,8 @@ func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndp changes.lock.Lock() defer changes.lock.Unlock() for _, change := range changes.items { - endpointsMap.Unmerge(change.previous) - endpointsMap.Merge(change.current) + em.Unmerge(change.previous) + em.Merge(change.current) detectStaleConnections(change.previous, change.current, staleEndpoints, staleServiceNames) } changes.items = make(map[types.NamespacedName]*endpointsChange) diff --git a/pkg/proxy/service.go b/pkg/proxy/service.go index 2d5bd352f53..eab394a9258 100644 --- a/pkg/proxy/service.go +++ b/pkg/proxy/service.go @@ -284,15 +284,15 @@ func (sct *ServiceChangeTracker) serviceToServiceMap(service *v1.Service) Servic // apply the changes to ServiceMap and update the stale udp cluster IP set. The UDPStaleClusterIP argument is passed in to store the // udp protocol service cluster ip when service is deleted from the ServiceMap. -func (serviceMap *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) { +func (sm *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) { changes.lock.Lock() defer changes.lock.Unlock() for _, change := range changes.items { - serviceMap.merge(change.current) + sm.merge(change.current) // filter out the Update event of current changes from previous changes before calling unmerge() so that can // skip deleting the Update events. change.previous.filter(change.current) - serviceMap.unmerge(change.previous, UDPStaleClusterIP) + sm.unmerge(change.previous, UDPStaleClusterIP) } // clear changes after applying them to ServiceMap. changes.items = make(map[types.NamespacedName]*serviceChange) diff --git a/pkg/proxy/util/network.go b/pkg/proxy/util/network.go index fa5c9fc7535..504ad939ace 100644 --- a/pkg/proxy/util/network.go +++ b/pkg/proxy/util/network.go @@ -33,12 +33,12 @@ type NetworkInterfacer interface { type RealNetwork struct{} // Addrs wraps net.Interface.Addrs(), it's a part of NetworkInterfacer interface. -func (_ RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) { +func (RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) { return intf.Addrs() } // Interfaces wraps net.Interfaces(), it's a part of NetworkInterfacer interface. -func (_ RealNetwork) Interfaces() ([]net.Interface, error) { +func (RealNetwork) Interfaces() ([]net.Interface, error) { return net.Interfaces() }