aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/fsbind.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/fsbind.go
parentc989e7785aa1ca5bf94aef5e096c86ae9af345df (diff)
hst/fs: valid method on underlying interface
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fsbind.go')
-rw-r--r--hst/fsbind.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/hst/fsbind.go b/hst/fsbind.go
index e95eb7b7..18d9cf74 100644
--- a/hst/fsbind.go
+++ b/hst/fsbind.go
@@ -27,9 +27,10 @@ type FSBind struct {
}
func (b *FSBind) Type() string { return FilesystemBind }
+func (b *FSBind) Valid() bool { return b != nil && b.Src != nil }
func (b *FSBind) Target() *container.Absolute {
- if b == nil || b.Src == nil {
+ if !b.Valid() {
return nil
}
if b.Dst == nil {
@@ -39,14 +40,14 @@ func (b *FSBind) Target() *container.Absolute {
}
func (b *FSBind) Host() []*container.Absolute {
- if b == nil || b.Src == nil {
+ if !b.Valid() {
return nil
}
return []*container.Absolute{b.Src}
}
func (b *FSBind) Apply(ops *container.Ops) {
- if b == nil || b.Src == nil {
+ if !b.Valid() {
return
}
@@ -69,7 +70,7 @@ func (b *FSBind) Apply(ops *container.Ops) {
func (b *FSBind) String() string {
g := 4
- if b == nil || b.Src == nil {
+ if !b.Valid() {
return "<invalid>"
}