ci: fix golangci-lint failures
Change-Id: Ia8c4dd03439ce4e3f85890d45255b8ea1c94b50a
This commit is contained in:
parent
09ca382abf
commit
0de1b5fa9f
@ -74,11 +74,11 @@ func (m *service) Execute(args []string, r <-chan svc.ChangeRequest, changes cha
|
||||
cancel()
|
||||
_ = group.Wait() // process.Exec does not return an error
|
||||
// After returning the Windows Service is stopped and the process terminates
|
||||
return
|
||||
return false, 0
|
||||
default:
|
||||
zap.L().Info("Unexpected control request.", zap.Uint32("Event Type", c.EventType))
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
return false, 0
|
||||
}
|
||||
|
@ -64,12 +64,12 @@ func restartService(ctx context.Context, service, binaryLocation, newVersionPath
|
||||
|
||||
// stop service if it's not stopped
|
||||
if status.State != svc.Stopped && status.State != svc.StopPending {
|
||||
if err = serviceControl(srvc, ctx, svc.Stop, svc.Stopped, 10*time.Second); err != nil {
|
||||
if err = serviceControl(ctx, srvc, svc.Stop, svc.Stopped, 10*time.Second); err != nil {
|
||||
return errs.Combine(errs.Wrap(err), os.Remove(newVersionPath))
|
||||
}
|
||||
// if it is stopping wait for it to complete
|
||||
} else if status.State == svc.StopPending {
|
||||
if err = serviceWaitForState(srvc, ctx, svc.Stopped, 10*time.Second); err != nil {
|
||||
if err = serviceWaitForState(ctx, srvc, svc.Stopped, 10*time.Second); err != nil {
|
||||
return errs.Combine(errs.Wrap(err), os.Remove(newVersionPath))
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ func openService(name string) (_ *mgr.Service, err error) {
|
||||
return service, nil
|
||||
}
|
||||
|
||||
func serviceControl(service *mgr.Service, ctx context.Context, cmd svc.Cmd, state svc.State, delay time.Duration) error {
|
||||
func serviceControl(ctx context.Context, service *mgr.Service, cmd svc.Cmd, state svc.State, delay time.Duration) error {
|
||||
status, err := service.Control(cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -155,7 +155,7 @@ func serviceControl(service *mgr.Service, ctx context.Context, cmd svc.Cmd, stat
|
||||
return nil
|
||||
}
|
||||
|
||||
func serviceWaitForState(service *mgr.Service, ctx context.Context, state svc.State, delay time.Duration) error {
|
||||
func serviceWaitForState(ctx context.Context, service *mgr.Service, state svc.State, delay time.Duration) error {
|
||||
status, err := service.Query()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -85,10 +85,11 @@ func (m *service) Execute(args []string, r <-chan svc.ChangeRequest, changes cha
|
||||
cancel()
|
||||
_ = group.Wait() // process.Exec does not return an error
|
||||
// After returning the Windows Service is stopped and the process terminates
|
||||
return
|
||||
return false, 0
|
||||
default:
|
||||
zap.L().Info("Unexpected control request.", zap.Uint32("Event Type", c.EventType))
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
return false, 0
|
||||
}
|
||||
|
4
go.sum
4
go.sum
@ -649,5 +649,5 @@ storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b h1:Bbg9JCtY6l3HrDxs3BX
|
||||
storj.io/monkit-jaeger v0.0.0-20200518165323-80778fc3f91b/go.mod h1:gj4vuCeyCRjRmH8LIrgoyU9Dc9uR6H+/GcDUXmTbf80=
|
||||
storj.io/private v0.0.0-20200527091855-082647005cf3 h1:niVMosczB5dcenexg5gIvbn5hfFeFweGIB5vykRHHPQ=
|
||||
storj.io/private v0.0.0-20200527091855-082647005cf3/go.mod h1:iDgIudPntDcHt5vyOecd2KS7YEx3E5CD0/sxjtM7fG0=
|
||||
storj.io/uplink v1.0.7-0.20200603150248-192c18781150 h1:baaiCtLs0jxoiqCr5xVZ4+jGUsMHQ/A/sfpghel18i4=
|
||||
storj.io/uplink v1.0.7-0.20200603150248-192c18781150/go.mod h1:PiLAqaFPUgsOs4u0xfVtm1jkWSQwdQmXv7KQUJUL/MU=
|
||||
storj.io/uplink v1.0.7 h1:vI0csamiYsN2vTj17x4QUUQ8xyyFVQvNzxJjUsSEi7U=
|
||||
storj.io/uplink v1.0.7/go.mod h1:PiLAqaFPUgsOs4u0xfVtm1jkWSQwdQmXv7KQUJUL/MU=
|
||||
|
Loading…
Reference in New Issue
Block a user