Skip to content

Commit

Permalink
Make ExampleConfig_timeout executable
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed May 7, 2024
1 parent 842ca29 commit 21f9cf6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ func ExampleConfig_timeout() {
return net.DialTimeout(network, addr, 2*time.Second)
},
})
defer func() {
conn.Close()
}()

log.Printf("conn: %v, err: %v", conn, err)
if err == nil && !conn.IsClosed() {
fmt.Println("connected")
}

// Output:
// connected
}

func ExampleDialTLS() {
Expand Down

0 comments on commit 21f9cf6

Please sign in to comment.