From e68db7fbfc367f25ccbaf57ec43f0f4b3c93cba7 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 6 Sep 2025 16:16:03 +0900 Subject: system: unexport Op implementations None of these are valid with their zero value, and the implementations assume they are created by the builder methods. They are by all means an implementation detail and exporting them makes no sense. Signed-off-by: Ophestra --- system/link.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'system/link.go') diff --git a/system/link.go b/system/link.go index 544443e9..8df85fc1 100644 --- a/system/link.go +++ b/system/link.go @@ -5,29 +5,29 @@ import ( "os" ) -// Link appends [HardlinkOp] to [I] the [Process] criteria. +// Link calls LinkFileType with the [Process] criteria. func (sys *I) Link(oldname, newname string) *I { return sys.LinkFileType(Process, oldname, newname) } -// LinkFileType appends [HardlinkOp] to [I]. +// LinkFileType maintains a hardlink until its [Enablement] is no longer satisfied. func (sys *I) LinkFileType(et Enablement, oldname, newname string) *I { - sys.ops = append(sys.ops, &HardlinkOp{et, newname, oldname}) + sys.ops = append(sys.ops, &hardlinkOp{et, newname, oldname}) return sys } -// HardlinkOp maintains a hardlink until its [Enablement] is no longer satisfied. -type HardlinkOp struct { +// hardlinkOp implements [I.LinkFileType]. +type hardlinkOp struct { et Enablement dst, src string } -func (l *HardlinkOp) Type() Enablement { return l.et } +func (l *hardlinkOp) Type() Enablement { return l.et } -func (l *HardlinkOp) apply(*I) error { +func (l *hardlinkOp) apply(*I) error { msg.Verbose("linking", l) return newOpError("hardlink", os.Link(l.src, l.dst), false) } -func (l *HardlinkOp) revert(_ *I, ec *Criteria) error { +func (l *hardlinkOp) revert(_ *I, ec *Criteria) error { if ec.hasType(l.Type()) { msg.Verbosef("removing hard link %q", l.dst) return newOpError("hardlink", os.Remove(l.dst), true) @@ -37,10 +37,10 @@ func (l *HardlinkOp) revert(_ *I, ec *Criteria) error { } } -func (l *HardlinkOp) Is(o Op) bool { - target, ok := o.(*HardlinkOp) +func (l *hardlinkOp) Is(o Op) bool { + target, ok := o.(*hardlinkOp) return ok && l != nil && target != nil && *l == *target } -func (l *HardlinkOp) Path() string { return l.src } -func (l *HardlinkOp) String() string { return fmt.Sprintf("%q from %q", l.dst, l.src) } +func (l *hardlinkOp) Path() string { return l.src } +func (l *hardlinkOp) String() string { return fmt.Sprintf("%q from %q", l.dst, l.src) } -- cgit v1.3.1