From 62ff4e782bc057d277a7c41fa35a665e2aeca045 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 6 Jul 2026 23:56:32 +0300 Subject: initial package management --- examples/examples.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/examples.go') diff --git a/examples/examples.go b/examples/examples.go index 2168a40..51508a4 100644 --- a/examples/examples.go +++ b/examples/examples.go @@ -32,7 +32,7 @@ func Run() error { // 7. Ensuring something is absent (two equivalent styles; each resource // path may only be declared once per run, so they use distinct paths) - File("/tmp/gonf_old.txt", IsAbsent()) + File("/tmp/gonf_old.txt", IsAbsent) NoFile("/tmp/gonf_old_alt.txt") // Alternative way // 8. A directory tree copied from source, reconciled, with a distinct @@ -40,7 +40,7 @@ func Run() error { Dir( "/tmp/gonf_dir_from_source", WithSource("assets/testfiles"), - WithPrune(), + WithPrune, WithFileMode(0o644), ) @@ -49,23 +49,23 @@ func Run() error { // (rather than reusing #8's path) to give WithPrune's recursive removal // something real to demonstrate. _ = os.MkdirAll("/tmp/gonf_stale_dir/nested", 0o755) - Dir("/tmp/gonf_stale_dir", IsAbsent(), WithPrune()) + Dir("/tmp/gonf_stale_dir", IsAbsent, WithPrune) _ = os.MkdirAll("/tmp/gonf_stale_dir_alt/nested", 0o755) - NoDir("/tmp/gonf_stale_dir_alt", WithPrune()) // Alternative way + NoDir("/tmp/gonf_stale_dir_alt", WithPrune) // Alternative way // 10. Non-recursively removing an empty directory _ = os.Mkdir("/tmp/gonf_stale_empty_dir", 0o755) - Dir("/tmp/gonf_stale_empty_dir", IsAbsent()) + Dir("/tmp/gonf_stale_empty_dir", IsAbsent) // 11. Ensuring a symlink is absent _ = os.Symlink("/tmp/gonf_hello.txt", "/tmp/gonf_stale_link") - Link("/tmp/gonf_stale_link", IsAbsent()) + Link("/tmp/gonf_stale_link", IsAbsent) _ = os.Symlink("/tmp/gonf_hello.txt", "/tmp/gonf_stale_link_alt") NoLink("/tmp/gonf_stale_link_alt") // Alternative way // 12. Ensuring a hardlink is absent _ = os.Link("/tmp/gonf_hello.txt", "/tmp/gonf_stale_hardlink") - Link("/tmp/gonf_stale_hardlink", IsAbsent()) + Link("/tmp/gonf_stale_hardlink", IsAbsent) return Apply() } -- cgit v1.2.3