aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/fsephemeral.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-14 21:36:22 +0900
committerOphestra <cat@gensokyo.uk>2025-08-14 21:36:22 +0900
commit0e543a58b36d4ab5d61c02ce93cf72bf2f218857 (patch)
treeae36b0a71c8c8e0275f72dd2f1593fd7cfa33d8f /hst/fsephemeral.go
parentc989e7785aa1ca5bf94aef5e096c86ae9af345df (diff)
hst/fs: valid method on underlying interface
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fsephemeral.go')
-rw-r--r--hst/fsephemeral.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/hst/fsephemeral.go b/hst/fsephemeral.go
index e3f924c5..209b615f 100644
--- a/hst/fsephemeral.go
+++ b/hst/fsephemeral.go
@@ -26,9 +26,10 @@ type FSEphemeral struct {
}
func (e *FSEphemeral) Type() string { return FilesystemEphemeral }
+func (e *FSEphemeral) Valid() bool { return e != nil && e.Dst != nil }
func (e *FSEphemeral) Target() *container.Absolute {
- if e == nil {
+ if !e.Valid() {
return nil
}
return e.Dst
@@ -39,7 +40,7 @@ func (e *FSEphemeral) Host() []*container.Absolute { return nil }
const fsEphemeralDefaultPerm = os.FileMode(0755)
func (e *FSEphemeral) Apply(ops *container.Ops) {
- if e == nil || e.Dst == nil {
+ if !e.Valid() {
return
}
@@ -61,7 +62,7 @@ func (e *FSEphemeral) Apply(ops *container.Ops) {
}
func (e *FSEphemeral) String() string {
- if e == nil || e.Dst == nil {
+ if !e.Valid() {
return "<invalid>"
}