-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add rough separation of concerns
In the earlier version, the same function updated the repo and reported the result. In this version, we separate updating from reporting. I am not sure whether this is the best way to do it. To be continued...
- Loading branch information
1 parent
3bcd0b9
commit 9fccd9d
Showing
4 changed files
with
54 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
linters-settings: | ||
copyloopvar: | ||
check-alias: true | ||
depguard: | ||
rules: | ||
main: | ||
|
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
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,27 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
// Publisher is the interface that wraps the Publish method. | ||
type Publisher interface { | ||
Publish() | ||
} | ||
|
||
type Success struct { | ||
msg string | ||
} | ||
|
||
type Failure struct { | ||
msg string | ||
} | ||
|
||
func (s Success) Publish() { | ||
fmt.Fprintln(os.Stdout, s.msg) | ||
} | ||
|
||
func (f Failure) Publish() { | ||
fmt.Fprintln(os.Stderr, f.msg) | ||
} |
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