summaryrefslogtreecommitdiff
path: root/pkg/files.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-09-04 09:11:35 +0200
committerJulien Dessaux2024-09-04 09:11:35 +0200
commit00cb3a2488db11c8ce96d182915b8c448edce976 (patch)
tree80d46044e4cdd17c2da324527596e34359a03603 /pkg/files.go
parentfeat(stdlib): added a basic borg client custom promise (diff)
downloadgonf-00cb3a2488db11c8ce96d182915b8c448edce976.tar.gz
gonf-00cb3a2488db11c8ce96d182915b8c448edce976.tar.bz2
gonf-00cb3a2488db11c8ce96d182915b8c448edce976.zip
chore(gonf): add a DECLARED promise status and make it the default instead of PROMISED
Diffstat (limited to 'pkg/files.go')
-rw-r--r--pkg/files.go9
1 files changed, 6 insertions, 3 deletions
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
}