From df9a0c77975a1c0a3ccff57303caac94139bb533 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 24 May 2018 01:13:35 +0200 Subject: [PATCH] Minor refactor: use anyChanged() to detect changed flags Signed-off-by: Sebastiaan van Stijn --- cli/command/service/update.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/command/service/update.go b/cli/command/service/update.go index 1124d703e1..66494fdbb9 100644 --- a/cli/command/service/update.go +++ b/cli/command/service/update.go @@ -313,12 +313,13 @@ func updateService(ctx context.Context, apiClient client.NetworkAPIClient, flags return err } - if flags.Changed(flagLimitCPU) || flags.Changed(flagLimitMemory) { + if anyChanged(flags, flagLimitCPU, flagLimitMemory) { taskResources().Limits = spec.TaskTemplate.Resources.Limits updateInt64Value(flagLimitCPU, &task.Resources.Limits.NanoCPUs) updateInt64Value(flagLimitMemory, &task.Resources.Limits.MemoryBytes) } - if flags.Changed(flagReserveCPU) || flags.Changed(flagReserveMemory) { + + if anyChanged(flags, flagReserveCPU, flagReserveMemory) { taskResources().Reservations = spec.TaskTemplate.Resources.Reservations updateInt64Value(flagReserveCPU, &task.Resources.Reservations.NanoCPUs) updateInt64Value(flagReserveMemory, &task.Resources.Reservations.MemoryBytes)