Adjusting the BeforeStart () position (#1263)

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
Eric 2020-02-26 16:44:10 +08:00 committed by GitHub
parent 80f2bfd5d0
commit 1034837f69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,6 +154,12 @@ func (s *service) start() error {
return nil return nil
} }
for _, fn := range s.opts.BeforeStart {
if err := fn(); err != nil {
return err
}
}
l, err := s.listen("tcp", s.opts.Address) l, err := s.listen("tcp", s.opts.Address)
if err != nil { if err != nil {
return err return err
@ -192,12 +198,6 @@ func (s *service) start() error {
}) })
} }
for _, fn := range s.opts.BeforeStart {
if err := fn(); err != nil {
return err
}
}
var httpSrv *http.Server var httpSrv *http.Server
if s.opts.Server != nil { if s.opts.Server != nil {
httpSrv = s.opts.Server httpSrv = s.opts.Server