Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

context is not cancelled when ListenAndServe returns error #15

Closed
raeperd opened this issue Oct 20, 2024 · 0 comments · Fixed by #16
Closed

context is not cancelled when ListenAndServe returns error #15

raeperd opened this issue Oct 20, 2024 · 0 comments · Fixed by #16
Assignees
Labels
bug Something isn't working

Comments

@raeperd
Copy link
Owner

raeperd commented Oct 20, 2024

Must cancel context properly for error returned by http.ListenAndServe

kickstart.go/main.go

Lines 59 to 65 in d0d0a2c

go func() {
slog.InfoContext(ctx, "server started", slog.String("addr", server.Addr))
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
slog.ErrorContext(ctx, "server error", slog.Any("error", err))
}
}()
<-ctx.Done()

Thanks to

raeperd added a commit that referenced this issue Oct 20, 2024
raeperd added a commit that referenced this issue Oct 20, 2024
@raeperd raeperd self-assigned this Dec 11, 2024
@raeperd raeperd added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant