-
Notifications
You must be signed in to change notification settings - Fork 184
feat: add http.StartServer2 with more customization #725
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
base: main
Are you sure you want to change the base?
feat: add http.StartServer2 with more customization #725
Conversation
@jrschumacher I see the PR is still in draft. Is there still work you intend to do here? Typically we wait with reviews until a PR is marked "ready for review". |
var ErrStartServerListenAndServe = errors.New("server.ListenAndServe():") | ||
var ErrStartServerShutdown = errors.New("server.Shutdown():") | ||
|
||
func StartServer2(ctx context.Context, port string, opts ...func(*startServerOpts)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this to a more meaningful name? StartServerWithOptions
maybe?
Also, it would be useful to have some docs that explain how is StartServer2
different from StartServer
if options.errorChannel != nil { | ||
*options.errorChannel <- fmt.Errorf("%w %v", ErrStartServerListenAndServe, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering what's the behaviour in case I call Startserver2()
without any option. In that case, errorChannel
will be nil
. If so, I think the server will shutdown silently without any message to the user of that happening. I would, at least, put a log.Error
when errorChannel == nil
. Same goes for lines 148 - 150.
Hey @jrschumacher can you pls have a look at Marco's feedback/comments? Thank you! |
Close #710
Definition of Ready