-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Bump go 1.8 #1259
Bump go 1.8 #1259
Conversation
7021f43
to
b344f93
Compare
server.go
Outdated
log.Infof("Starting server on %s", srv.Addr) | ||
if srv.TLSConfig != nil { | ||
if err := srv.ListenAndServeTLSWithConfig(srv.TLSConfig); err != nil { | ||
err := srv.ListenAndServeTLS("", "") |
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.
You could declare the err
variable at the top, assign it in each TLS/no-TLS case, and check for nil
once only:
var err error
if srv.TLSConfig != nil {
err = srv.ListenAndServeTLS("", "")
} else {
err = srv.ListenAndServe()
}
if err != nil {
log.Fatal("Error creating server: ", err)
}
Saves us one nested level of if
ing.
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.
Yep, done.
server.go
Outdated
cancel() | ||
}() | ||
<-ctx.Done() | ||
log.Debugf("Waiting %d seconds before killing connections on entrypoint %s...", server.globalConfiguration.GraceTimeOut, serverEntryPointName) |
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.
What's the reason we don't wrap this in a go routine anymore?
IIUC, we are now shutting down the server entry points sequentially whereas we used to do so concurrently.
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.
In fact, it was not working in the old version because of <-ctx.Done()
.
I used a WaitGroup
instead.
cac3b97
to
101f6aa
Compare
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.
LGTM. :)
Signed-off-by: Emile Vauge <emile@vauge.com>
Signed-off-by: Emile Vauge <emile@vauge.com>
Signed-off-by: Emile Vauge <emile@vauge.com>
d0e741e
to
1140ee6
Compare
Updated and green! We need one more LGTM. :-) |
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.
LGTM
This PR bumps go version to 1.8 and removes dependency to https://github.com/mailgun/manners using native graceful shutdown instead.