aboutsummaryrefslogtreecommitdiff
path: root/hook.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-12-18 16:24:06 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-12-18 16:24:06 +0100
commitbdcc98eaf07bdbc478223c38cf06266b76177776 (patch)
treefbfc93bd393efbb5aae941063ef7d9203e9410fe /hook.go
parent9e6973bffbf876ea6cbd403f211dd81798ec89dd (diff)
Use struct instead of bool
Diffstat (limited to 'hook.go')
-rw-r--r--hook.go18
1 files changed, 2 insertions, 16 deletions
diff --git a/hook.go b/hook.go
index a5c84da..a9c0272 100644
--- a/hook.go
+++ b/hook.go
@@ -6,33 +6,19 @@ import (
"strings"
)
-type Hooker map[string]bool
+type Hooker map[string]struct{}
func execHook(s string) error {
cmd := strings.Fields(s)
return exec.Command(cmd[0], cmd[1:]...).Run()
}
-/*
-func NewHooker() chan string {
- h := make(chan string, 2)
- go func() {
- for hook := range h {
- if err := execHook(hook); err != nil {
- log.Println(hook, err)
- }
- }
- }()
- return h
-}
-*/
-
func NewHooker() Hooker {
return make(Hooker)
}
func (h Hooker) Notice(cmd string) {
- h[cmd] = true
+ h[cmd] = struct{}{}
}
func (h Hooker) Execute() {