hst/fs: valid method on underlying interface
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 1m59s
Test / Hakurei (push) Successful in 3m6s
Test / Hpkg (push) Successful in 4m16s
Test / Sandbox (race detector) (push) Successful in 4m24s
Test / Hakurei (race detector) (push) Successful in 5m7s
Test / Flake checks (push) Successful in 1m39s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-08-14 21:36:22 +09:00
parent c989e7785a
commit 0e543a58b3
6 changed files with 38 additions and 22 deletions

View File

@@ -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>"
}