From 00cb3a2488db11c8ce96d182915b8c448edce976 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 4 Sep 2024 09:11:35 +0200 Subject: chore(gonf): add a DECLARED promise status and make it the default instead of PROMISED --- pkg/commands.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'pkg/commands.go') diff --git a/pkg/commands.go b/pkg/commands.go index 4222de7..e3f6242 100644 --- a/pkg/commands.go +++ b/pkg/commands.go @@ -23,7 +23,7 @@ func CommandWithEnv(env []string, cmd string, args ...string) *CommandPromise { cmd: cmd, env: env, err: nil, - status: PROMISED, + status: DECLARED, } } @@ -44,7 +44,10 @@ func (c *CommandPromise) IfRepaired(p ...Promise) Promise { } func (c *CommandPromise) Promise() *CommandPromise { - commands = append(commands, c) + if c.status == DECLARED { + c.status = PROMISED + commands = append(commands, c) + } return c } -- cgit v1.2.3