diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-23 12:34:16 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-23 12:34:16 +0900 |
| commit | 20195ece478a28b2bc7abc78cd220f900958eb35 (patch) | |
| tree | 8e996029a43c58ddfd15b6be9b5e285effeddbea /internal/system/mkdir.go | |
| parent | cafed5f23468daf2765655325ebe7d879acdde24 (diff) | |
system: return sys in queueing methods
This enables building an instance in a single statement.
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system/mkdir.go')
| -rw-r--r-- | internal/system/mkdir.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/internal/system/mkdir.go b/internal/system/mkdir.go index 0f3787f6..c868bee3 100644 --- a/internal/system/mkdir.go +++ b/internal/system/mkdir.go @@ -9,19 +9,23 @@ import ( ) // Ensure the existence and mode of a directory. -func (sys *I) Ensure(name string, perm os.FileMode) { +func (sys *I) Ensure(name string, perm os.FileMode) *I { sys.lock.Lock() defer sys.lock.Unlock() sys.ops = append(sys.ops, &Mkdir{User, name, perm, false}) + + return sys } // Ephemeral ensures the temporary existence and mode of a directory through the life of et. -func (sys *I) Ephemeral(et Enablement, name string, perm os.FileMode) { +func (sys *I) Ephemeral(et Enablement, name string, perm os.FileMode) *I { sys.lock.Lock() defer sys.lock.Unlock() sys.ops = append(sys.ops, &Mkdir{et, name, perm, true}) + + return sys } type Mkdir struct { |
