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

Bump go 1.8 #1259

Merged
merged 3 commits into from Mar 24, 2017
Merged

Bump go 1.8 #1259

merged 3 commits into from Mar 24, 2017

Conversation

emilevauge
Copy link
Member

This PR bumps go version to 1.8 and removes dependency to https://github.com/mailgun/manners using native graceful shutdown instead.

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("", "")
Copy link
Contributor

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 ifing.

Copy link
Member Author

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)
Copy link
Contributor

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.

Copy link
Member Author

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.

@emilevauge emilevauge force-pushed the bump-go-1.8 branch 2 times, most recently from cac3b97 to 101f6aa Compare March 9, 2017 22:28
Copy link
Contributor

@timoreimann timoreimann left a 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>
@timoreimann
Copy link
Contributor

Updated and green!

We need one more LGTM. :-)

Copy link
Contributor

@errm errm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timoreimann timoreimann merged commit 84e1ec6 into master Mar 24, 2017
@vdemeester vdemeester deleted the bump-go-1.8 branch March 24, 2017 08:38
@ldez ldez added this to the 1.3 milestone May 19, 2017
@ldez ldez added kind/enhancement a new or improved feature. and removed status/3-needs-merge labels May 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement a new or improved feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants