@@ -74,7 +74,7 @@ func TestDialerPortPolicy(t *testing.T) {
7474 ctx := context .Background ()
7575 conn , err := fd .Dial (ctx , "tcp" , "www.projectdiscovery.io:80" )
7676 if conn != nil {
77- conn .Close ()
77+ _ = conn .Close ()
7878 }
7979 if err != NoAddressAllowedError {
8080 t .Fatalf ("expected NoAddressAllowedError for denied port, got: %v" , err )
@@ -96,7 +96,7 @@ func TestDialerPortPolicy(t *testing.T) {
9696 if err != nil || conn == nil {
9797 t .Fatalf ("expected connection to succeed on non-denied port, got: %v" , err )
9898 }
99- conn .Close ()
99+ _ = conn .Close ()
100100 })
101101
102102 t .Run ("AllowPortPermits" , func (t * testing.T ) {
@@ -114,7 +114,7 @@ func TestDialerPortPolicy(t *testing.T) {
114114 if err != nil || conn == nil {
115115 t .Fatalf ("expected connection to succeed on allowed port, got: %v" , err )
116116 }
117- conn .Close ()
117+ _ = conn .Close ()
118118 })
119119
120120 t .Run ("AllowPortBlocksOther" , func (t * testing.T ) {
@@ -130,7 +130,7 @@ func TestDialerPortPolicy(t *testing.T) {
130130 ctx := context .Background ()
131131 conn , err := fd .Dial (ctx , "tcp" , "www.projectdiscovery.io:80" )
132132 if conn != nil {
133- conn .Close ()
133+ _ = conn .Close ()
134134 }
135135 if err != NoAddressAllowedError {
136136 t .Fatalf ("expected NoAddressAllowedError for non-allowed port, got: %v" , err )
@@ -151,7 +151,7 @@ func TestDialerPortPolicy(t *testing.T) {
151151 if err != nil || conn == nil {
152152 t .Fatalf ("expected connection to succeed without port policy, got: %v" , err )
153153 }
154- conn .Close ()
154+ _ = conn .Close ()
155155 })
156156
157157 t .Run ("DenyPortTriggersOnInvalidTarget" , func (t * testing.T ) {
@@ -173,9 +173,9 @@ func TestDialerPortPolicy(t *testing.T) {
173173 defer fd .Close ()
174174
175175 ctx := context .Background ()
176- conn , err := fd .Dial (ctx , "tcp" , "www.projectdiscovery.io:80" )
176+ conn , _ := fd .Dial (ctx , "tcp" , "www.projectdiscovery.io:80" )
177177 if conn != nil {
178- conn .Close ()
178+ _ = conn .Close ()
179179 }
180180
181181 mu .Lock ()
@@ -216,7 +216,9 @@ func TestDialerTargetValidation(t *testing.T) {
216216 if err != nil || conn == nil {
217217 t .Fatalf ("couldn't connect to target: %s" , err )
218218 }
219- defer conn .Close ()
219+ defer func () {
220+ _ = conn .Close ()
221+ }()
220222
221223 if ! validateCalled {
222224 t .Error ("OnValidateTarget was not called" )
@@ -253,7 +255,7 @@ func TestDialerTargetValidation(t *testing.T) {
253255 conn , err := fd .Dial (ctx , "tcp" , "www.projectdiscovery.io:80" )
254256 if err != NoAddressAllowedError {
255257 if conn != nil {
256- conn .Close ()
258+ _ = conn .Close ()
257259 }
258260 t .Fatalf ("expected NoAddressAllowedError, got: %v" , err )
259261 }
0 commit comments