Skip to content

Commit 5b34d95

Browse files
authored
Merge pull request kubernetes#77381 from JieJhih/network/golint
Fix golint
2 parents db44f31 + 21e4f00 commit 5b34d95

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

cmd/kube-proxy/app/server.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ func (o *Options) Complete() error {
236236
return err
237237
}
238238

239-
if err := utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates); err != nil {
240-
return err
241-
}
242-
return nil
239+
return utilfeature.DefaultMutableFeatureGate.SetFromMap(o.config.FeatureGates)
243240
}
244241

245242
// Creates a new filesystem watcher and adds watches for the config file.

pkg/proxy/endpoints.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,16 @@ func (ect *EndpointChangeTracker) endpointsToEndpointsMap(endpoints *v1.Endpoint
282282
// The changes map is cleared after applying them.
283283
// In addition it returns (via argument) and resets the lastChangeTriggerTimes for all endpoints
284284
// that were changed and will result in syncing the proxy rules.
285-
func (endpointsMap EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint,
285+
func (em EndpointsMap) apply(changes *EndpointChangeTracker, staleEndpoints *[]ServiceEndpoint,
286286
staleServiceNames *[]ServicePortName, lastChangeTriggerTimes *[]time.Time) {
287287
if changes == nil {
288288
return
289289
}
290290
changes.lock.Lock()
291291
defer changes.lock.Unlock()
292292
for _, change := range changes.items {
293-
endpointsMap.Unmerge(change.previous)
294-
endpointsMap.Merge(change.current)
293+
em.Unmerge(change.previous)
294+
em.Merge(change.current)
295295
detectStaleConnections(change.previous, change.current, staleEndpoints, staleServiceNames)
296296
}
297297
changes.items = make(map[types.NamespacedName]*endpointsChange)

pkg/proxy/service.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,15 @@ func (sct *ServiceChangeTracker) serviceToServiceMap(service *v1.Service) Servic
284284

285285
// apply the changes to ServiceMap and update the stale udp cluster IP set. The UDPStaleClusterIP argument is passed in to store the
286286
// udp protocol service cluster ip when service is deleted from the ServiceMap.
287-
func (serviceMap *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) {
287+
func (sm *ServiceMap) apply(changes *ServiceChangeTracker, UDPStaleClusterIP sets.String) {
288288
changes.lock.Lock()
289289
defer changes.lock.Unlock()
290290
for _, change := range changes.items {
291-
serviceMap.merge(change.current)
291+
sm.merge(change.current)
292292
// filter out the Update event of current changes from previous changes before calling unmerge() so that can
293293
// skip deleting the Update events.
294294
change.previous.filter(change.current)
295-
serviceMap.unmerge(change.previous, UDPStaleClusterIP)
295+
sm.unmerge(change.previous, UDPStaleClusterIP)
296296
}
297297
// clear changes after applying them to ServiceMap.
298298
changes.items = make(map[types.NamespacedName]*serviceChange)

pkg/proxy/util/network.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ type NetworkInterfacer interface {
3333
type RealNetwork struct{}
3434

3535
// Addrs wraps net.Interface.Addrs(), it's a part of NetworkInterfacer interface.
36-
func (_ RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) {
36+
func (RealNetwork) Addrs(intf *net.Interface) ([]net.Addr, error) {
3737
return intf.Addrs()
3838
}
3939

4040
// Interfaces wraps net.Interfaces(), it's a part of NetworkInterfacer interface.
41-
func (_ RealNetwork) Interfaces() ([]net.Interface, error) {
41+
func (RealNetwork) Interfaces() ([]net.Interface, error) {
4242
return net.Interfaces()
4343
}
4444

0 commit comments

Comments
 (0)