1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00

on service.Init only process options once

This commit is contained in:
Asim Aslam 2017-03-30 17:15:59 +01:00
parent a933aa79c6
commit b43985401a

View File

@ -68,9 +68,11 @@ func (s *service) Init(opts ...Option) {
// This is pretty ugly, find a better way
options := newOptions()
options.Cmd = s.opts.Cmd
for _, o := range opts {
o(&options)
}
s.opts.Cmd = options.Cmd
// Initialise the command flags, overriding new service
@ -82,11 +84,6 @@ func (s *service) Init(opts ...Option) {
cmd.Server(&s.opts.Server),
)
}
// Update any options to override command flags
for _, o := range opts {
o(&s.opts)
}
}
func (s *service) Options() Options {