Skip to content

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
aslmx committed Nov 5, 2020
1 parent f2f3130 commit c8eaeb2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 38 deletions.
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func db_del_dest(db *sql.DB, host string) {
log.Printf("deleting host %s", host)
_ , err := db.Exec("delete from dests where host=?", host);
if err != nil {
log.Fatal("could not insert host into destinations", err)
log.Fatal("could not delete host from destinations", err)
}
}

Expand Down
55 changes: 18 additions & 37 deletions pingwatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
display *time.Duration
port *string
addhost *string
delhost *string
delhost *string
)

func main() {
Expand Down Expand Up @@ -60,43 +60,27 @@ func main() {
}

if *addhost != "" {


log.Printf("Adding host %s", *addhost)
if *dsn != "" {
db, err = sql.Open("sqlite3", *dsn)
if err != nil {
log.Fatalf("ERROR: opening SQLite DB %q, error: %s", *dsn, err)
}


db_add_dest (db, *addhost)

}




os.Exit(0)
if *dsn != "" {
db, err = sql.Open("sqlite3", *dsn)
if err != nil {
log.Fatalf("ERROR: opening SQLite DB %q, error: %s", *dsn, err)
}
db_add_dest (db, *addhost)
}
os.Exit(0)
}

if *delhost != "" {

if *dsn != "" {
db, err = sql.Open("sqlite3", *dsn)
if err != nil {
log.Fatalf("ERROR: opening SQLite DB %q, error: %s", *dsn, err)
}


db_del_dest (db, *delhost)

if *dsn != "" {
db, err = sql.Open("sqlite3", *dsn)
if err != nil {
log.Fatalf("ERROR: opening SQLite DB %q, error: %s", *dsn, err)
}
db_del_dest (db, *delhost)
}
os.Exit(0)
}

os.Exit(0)
}



log.Println("starting pingwatch")

end := make(chan os.Signal)
Expand All @@ -111,9 +95,6 @@ func main() {
dump_goroutines()
}
}()



if *dsn != "" {
db, err = sql.Open("sqlite3", *dsn)
if err != nil {
Expand Down

0 comments on commit c8eaeb2

Please sign in to comment.