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/files.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'pkg/files.go') diff --git a/pkg/files.go b/pkg/files.go index 6f22176..ac63718 100644 --- a/pkg/files.go +++ b/pkg/files.go @@ -45,7 +45,7 @@ func Directory(filename any) *FilePromise { filename: interfaceToTemplateValue(filename), fileType: DIRECTORY, permissions: nil, - status: PROMISED, + status: DECLARED, } } @@ -58,7 +58,7 @@ func File(filename any) *FilePromise { filename: interfaceToTemplateValue(filename), fileType: FILE, permissions: nil, - status: PROMISED, + status: DECLARED, } } @@ -88,7 +88,10 @@ func (f *FilePromise) IfRepaired(p ...Promise) Promise { } func (f *FilePromise) Promise() *FilePromise { - files = append(files, f) + if f.status == DECLARED { + f.status = PROMISED + files = append(files, f) + } return f } -- cgit v1.2.3