Skip to content

Commit

Permalink
Use context for Listen
Browse files Browse the repository at this point in the history
  • Loading branch information
gzuidhof committed Apr 16, 2024
1 parent 0bb739c commit eb1d6e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hareply/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func (a *App) Serve(ctx context.Context) error {

a.logger.DebugContext(ctx, "initial response loaded", slog.String("response", string(response)))

listener, err := net.Listen("tcp", net.JoinHostPort(a.host, fmt.Sprint(a.port)))
lc := net.ListenConfig{}
listener, err := lc.Listen(ctx, "tcp", net.JoinHostPort(a.host, fmt.Sprint(a.port)))
if err != nil {

return fmt.Errorf("failed to listen: %w", err)
}

Expand Down

0 comments on commit eb1d6e4

Please sign in to comment.