From 37dd4afc74f4cdd1ad94ee1364b0fe74fa6e2813 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sat, 8 Nov 2014 00:46:59 -0500 Subject: [PATCH] fmt --- errors.go | 30 +++++++++++++++--------------- main.go | 26 +++++++++++++------------- speck.go | 16 ++++++++-------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/errors.go b/errors.go index 1201796..3267733 100644 --- a/errors.go +++ b/errors.go @@ -1,32 +1,32 @@ package main import ( - "strings" + "strings" ) const ( E_Ok int = iota E_No_Data - E_No_DB + E_No_DB ) type errorGroup []error func (e errorGroup) Error() string { - messages := make([]string, 0, len(e)) - for i, _ := range e { - messages[i] = e[i].Error() - } - return strings.Join(messages, " && ") + messages := make([]string, 0, len(e)) + for i, _ := range e { + messages[i] = e[i].Error() + } + return strings.Join(messages, " && ") } func (g *errorGroup) AddError(err error) { - if err == nil { - return - } - if g == nil { - panic("fart") - *g = make([]error, 0, 4) - } - *g = append(*g, err) + if err == nil { + return + } + if g == nil { + panic("fart") + *g = make([]error, 0, 4) + } + *g = append(*g, err) } diff --git a/main.go b/main.go index 95723cc..c52e67d 100644 --- a/main.go +++ b/main.go @@ -1,31 +1,31 @@ package main import ( - "fmt" - "os" + "fmt" + "os" ) var dataPath = "/projects/exo/expl.speck" func log_error(template string, args ...interface{}) { - fmt.Fprint(os.Stderr, "ERROR ") - fmt.Fprintf(os.Stderr, template+"\n", args...) + fmt.Fprint(os.Stderr, "ERROR ") + fmt.Fprintf(os.Stderr, template+"\n", args...) } func log_info(template string, args ...interface{}) { - fmt.Fprint(os.Stdout, "INFO ") - fmt.Fprintf(os.Stdout, template+"\n", args...) + fmt.Fprint(os.Stdout, "INFO ") + fmt.Fprintf(os.Stdout, template+"\n", args...) } func bail(status int, template string, args ...interface{}) { - if status == 0 { - fmt.Fprintf(os.Stdout, template, args...) - } else { - fmt.Fprintf(os.Stderr, template, args...) - } - os.Exit(status) + if status == 0 { + fmt.Fprintf(os.Stdout, template, args...) + } else { + fmt.Fprintf(os.Stderr, template, args...) + } + os.Exit(status) } func main() { - setupDb() + setupDb() } diff --git a/speck.go b/speck.go index 0b0883a..fe193e5 100644 --- a/speck.go +++ b/speck.go @@ -31,7 +31,7 @@ func speckStream(r io.ReadCloser, c chan exoSystem) { continue } planet := parseSpeckLine(line) - c <- *planet + c <- *planet } } @@ -49,17 +49,17 @@ func (e exoSystem) Store(db *sql.DB) { values (?, ?, ?, ?, ?) ;`, e.name, e.x, e.y, e.z, e.planets) - if err != nil { - log_error("%v", err) - } + if err != nil { + log_error("%v", err) + } } func countPlanets(db *sql.DB) (int, error) { - row := db.QueryRow(`select count(*) from planets`) + row := db.QueryRow(`select count(*) from planets`) - var n int - err := row.Scan(&n) - return n, err + var n int + err := row.Scan(&n) + return n, err } func (e exoSystem) String() string {