mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	Fix grpc test vet warning (#3341)
This fixes the vet warning: the cancel function returned by context.WithTimeout should be called, not discarded, to avoid a context leak. Signed-off-by: Ingo Gottwald <in.gottwald@gmail.com>
This commit is contained in:
		
				
					committed by
					
						 Miek Gieben
						Miek Gieben
					
				
			
			
				
	
			
			
			
						parent
						
							575cea4496
						
					
				
				
					commit
					fa6718d026
				
			| @@ -22,7 +22,8 @@ func TestGrpc(t *testing.T) { | ||||
| 	} | ||||
| 	defer g.Stop() | ||||
|  | ||||
| 	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second) | ||||
| 	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | ||||
| 	defer cancel() | ||||
| 	conn, err := grpc.DialContext(ctx, tcp, grpc.WithInsecure(), grpc.WithBlock()) | ||||
| 	if err != nil { | ||||
| 		t.Fatalf("Expected no error but got: %s", err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user