storing in redis, not storing newline

This commit is contained in:
2017-12-13 09:45:15 -05:00
parent 6957e44a83
commit 40ee7ebd80
2 changed files with 14 additions and 6 deletions
+11 -4
View File
@@ -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)
+3 -2
View File
@@ -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")
}