From 1cf6af14f2bb4d3e69968866503b6e5ed38d2aa8 Mon Sep 17 00:00:00 2001 From: Adam Leclerc Date: Thu, 5 Dec 2024 14:25:34 -0400 Subject: [PATCH] - F Reporter that will run first time --- ...t_automatically_approves_the_first_time.go | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 reporters/reporter_that_automatically_approves_the_first_time.go diff --git a/reporters/reporter_that_automatically_approves_the_first_time.go b/reporters/reporter_that_automatically_approves_the_first_time.go new file mode 100644 index 0000000..bb6b944 --- /dev/null +++ b/reporters/reporter_that_automatically_approves_the_first_time.go @@ -0,0 +1,22 @@ +package reporters + +import ( + "os" +) + +type reporterThatAutomaticallyApprovesTheFirstTime struct{} + +func NewReporterThatAutomaticallyApprovesTheFirstTime() Reporter { + return &reporterThatAutomaticallyApprovesTheFirstTime{} +} + +func (s *reporterThatAutomaticallyApprovesTheFirstTime) Report(approved, received string) bool { + + // If the approved file exists, just return true + if _, err := os.Stat(approved); err == nil { + return true + } + + //other call the other reporter + return NewReporterThatAutomaticallyApproves().Report(approved, received) +}