-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- F Reporter that will run first time
- Loading branch information
1 parent
ff769f6
commit 1cf6af1
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
reporters/reporter_that_automatically_approves_the_first_time.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |