@@ -165,6 +165,7 @@ func (c *Client) WatchServices(ctx context.Context, serviceName string, onChange
165165 // Route table unchanged — update cache but skip remounting
166166 c .manifestCache [event .Manifest .InstanceID ] = event .Manifest
167167 c .mu .Unlock ()
168+
168169 return
169170 }
170171 }
@@ -196,8 +197,10 @@ func (c *Client) WatchServices(ctx context.Context, serviceName string, onChange
196197 if newHash == c .currentRoutesHash {
197198 // Routes unchanged — skip remounting
198199 c .mu .Unlock ()
200+
199201 return
200202 }
203+
201204 c .currentRoutesHash = newHash
202205 c .mu .Unlock ()
203206
@@ -229,6 +232,7 @@ func (c *Client) WatchServicesAtomic(ctx context.Context, serviceName string, ha
229232
230233 if err := handler .CommitRoutes (); err != nil {
231234 _ = handler .RollbackRoutes ()
235+
232236 return fmt .Errorf ("failed to commit initial routes: %w" , err )
233237 }
234238
@@ -248,6 +252,7 @@ func (c *Client) WatchServicesAtomic(ctx context.Context, serviceName string, ha
248252 old .RoutesChecksum == event .Manifest .RoutesChecksum {
249253 c .manifestCache [event .Manifest .InstanceID ] = event .Manifest
250254 c .mu .Unlock ()
255+
251256 return
252257 }
253258 }
@@ -275,8 +280,10 @@ func (c *Client) WatchServicesAtomic(ctx context.Context, serviceName string, ha
275280 c .mu .Lock ()
276281 if newHash == c .currentRoutesHash {
277282 c .mu .Unlock ()
283+
278284 return
279285 }
286+
280287 c .currentRoutesHash = newHash
281288 c .mu .Unlock ()
282289
@@ -302,6 +309,7 @@ func (c *Client) convertToRouteDescriptors(manifests []*farp.SchemaManifest) []f
302309 // Prefer pre-computed route table if available
303310 if len (manifest .RouteTable ) > 0 {
304311 routes = append (routes , manifest .RouteTable ... )
312+
305313 continue
306314 }
307315
@@ -339,7 +347,7 @@ func computeRouteTableHash(routes []ServiceRoute) string {
339347 return entries [i ].Path < entries [j ].Path
340348 })
341349
342- data , _ := json .Marshal (entries )
350+ data , _ := json .Marshal (entries ) //nolint:errchkjson // simple struct cannot fail to marshal
343351 hash := sha256 .Sum256 (data )
344352
345353 return hex .EncodeToString (hash [:])
@@ -365,10 +373,11 @@ func computeRouteDescriptorHash(routes []farp.RouteDescriptor) string {
365373 if entries [i ].Path != entries [j ].Path {
366374 return entries [i ].Path < entries [j ].Path
367375 }
376+
368377 return entries [i ].Protocol < entries [j ].Protocol
369378 })
370379
371- data , _ := json .Marshal (entries )
380+ data , _ := json .Marshal (entries ) //nolint:errchkjson // simple struct cannot fail to marshal
372381 hash := sha256 .Sum256 (data )
373382
374383 return hex .EncodeToString (hash [:])
@@ -479,7 +488,7 @@ func (c *Client) fetchSchema(ctx context.Context, descriptor *farp.SchemaDescrip
479488 }
480489
481490 // Execute request
482- resp , err := c .httpClient .Do (req )
491+ resp , err := c .httpClient .Do (req ) //nolint:gosec // URL comes from service manifest, not user input
483492 if err != nil {
484493 return nil , fmt .Errorf ("failed to fetch schema from URL %s: %w" , descriptor .Location .URL , err )
485494 }
@@ -849,7 +858,7 @@ func computeManifestsHash(cache map[string]*farp.SchemaManifest) string {
849858 return entries [i ].ID < entries [j ].ID
850859 })
851860
852- data , _ := json .Marshal (entries )
861+ data , _ := json .Marshal (entries ) //nolint:errchkjson // simple struct cannot fail to marshal
853862 hash := sha256 .Sum256 (data )
854863
855864 return hex .EncodeToString (hash [:])
0 commit comments