From 2276f8f4959225ea645b1b6d444aadba6e4ae2aa Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 28 Jun 2024 15:10:37 -0700 Subject: [PATCH] Move function to method on system artifacts We can test nil-ness inside the method. --- frontend/rpm/template.go | 6 +++--- spec.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/rpm/template.go b/frontend/rpm/template.go index e79ecbf0..10dd6d2b 100644 --- a/frontend/rpm/template.go +++ b/frontend/rpm/template.go @@ -294,7 +294,7 @@ func (w *specWrapper) BuildSteps() fmt.Stringer { func (w *specWrapper) PreUn() fmt.Stringer { b := &strings.Builder{} - if dalec.SystemdIsEmpty(w.Artifacts.Systemd) { + if w.Artifacts.Systemd.IsEmpty() { return b } @@ -311,7 +311,7 @@ func (w *specWrapper) PreUn() fmt.Stringer { func (w *specWrapper) Post() fmt.Stringer { b := &strings.Builder{} - if dalec.SystemdIsEmpty(w.Artifacts.Systemd) { + if w.Artifacts.Systemd.IsEmpty() { return b } @@ -330,7 +330,7 @@ func (w *specWrapper) Post() fmt.Stringer { func (w *specWrapper) PostUn() fmt.Stringer { b := &strings.Builder{} - if dalec.SystemdIsEmpty(w.Artifacts.Systemd) { + if w.Artifacts.Systemd.IsEmpty() { return b } diff --git a/spec.go b/spec.go index b2e1792d..37f0caa3 100644 --- a/spec.go +++ b/spec.go @@ -683,7 +683,7 @@ func (c *CheckOutputError) Error() string { return fmt.Sprintf("expected %q %s %q, got %q", c.Path, c.Kind, c.Expected, c.Actual) } -func SystemdIsEmpty(s *SystemdConfiguration) bool { +func (s *SystemdConfiguration) IsEmpty() bool { if s == nil { return true }