mirror of
https://github.com/kennethreitz/herald.git
synced 2026-06-05 23:00:19 +00:00
storing in redis, not storing newline
This commit is contained in:
@@ -4,8 +4,7 @@ import "github.com/heroku/herald"
|
||||
import "github.com/fatih/color"
|
||||
import "time"
|
||||
import "log"
|
||||
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -49,9 +48,17 @@ func main() {
|
||||
// Execute the executable, print the results.
|
||||
results := exe.Execute()
|
||||
|
||||
// for _, result := range(results) {
|
||||
for _, result := range(results) {
|
||||
key := fmt.Sprintf("%s:%s:%s", bp, exe, result)
|
||||
value := "UNKNOWN"
|
||||
|
||||
// }
|
||||
// Store the results in Redis.
|
||||
_, err := redis.Do("SETNX", key, value)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Log results.
|
||||
log.Printf("%s:%s results: %s", red(bp), magenta(exe), results)
|
||||
|
||||
@@ -26,9 +26,10 @@ func RedisConnect() redis.Conn {
|
||||
// Fail epically.
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
// defer c.Close()
|
||||
return c
|
||||
|
||||
}
|
||||
|
||||
// TODO: Maybe remove.
|
||||
@@ -70,7 +71,7 @@ func (e Executable) Execute() []string {
|
||||
// TODO: Update this to return, etc.
|
||||
log.Fatal(err)
|
||||
}
|
||||
return strings.Split(string(out), "\n")
|
||||
return strings.Split(strings.Trim(string(out), "\n"), "\n")
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user