diff --git a/autocomplete.go b/autocomplete.go index 28e79ac..2aba215 100644 --- a/autocomplete.go +++ b/autocomplete.go @@ -1,7 +1,6 @@ package main import ( - // "github.com/davecgh/go-spew/spew" "log" "regexp" "strings" diff --git a/chc.go b/chc.go index decb1a9..cc749c8 100644 --- a/chc.go +++ b/chc.go @@ -25,15 +25,12 @@ package main import ( "fmt" + "log" "os" "strings" "github.com/jessevdk/go-flags" "github.com/mattn/go-isatty" - // "io/ioutil" - "log" - //"math" - // "net/url" ) const ( diff --git a/clickhouse_http.go b/clickhouse_http.go index edb90d5..8ac9afb 100644 --- a/clickhouse_http.go +++ b/clickhouse_http.go @@ -3,20 +3,18 @@ package main import ( "bufio" "bytes" + "context" "encoding/json" "errors" "fmt" "io" - "net" - "os" - "time" - // "log" - // "net" - "context" "io/ioutil" + "net" "net/http" "net/url" + "os" "strings" + "time" ) func getHost() string { diff --git a/clickhouse_requests.go b/clickhouse_requests.go index 92dece0..6bf738b 100644 --- a/clickhouse_requests.go +++ b/clickhouse_requests.go @@ -4,23 +4,17 @@ import ( "context" "errors" "fmt" - // "github.com/davecgh/go-spew/spew" "io" - "os/signal" - "regexp" - - "github.com/davecgh/go-spew/spew" - "github.com/satori/go.uuid" // generate sessionID and queryID - // "io/ioutil" "log" - //"math" - "os" - // "net/url" - + "os/signal" + "regexp" "strconv" "strings" "time" + + "github.com/davecgh/go-spew/spew" + "github.com/satori/go.uuid" // generate sessionID and queryID ) var sessionID = uuid.NewV4().String() @@ -95,8 +89,8 @@ func getQueryStats(queryID string) (qs queryStats, err error) { return } - duration_ms, _ := strconv.ParseUint(data[0][0], 10, 64) - qs.QueryDuration = time.Duration(duration_ms) * time.Millisecond + durationMs, _ := strconv.ParseUint(data[0][0], 10, 64) + qs.QueryDuration = time.Duration(durationMs) * time.Millisecond qs.ReadRows, _ = strconv.ParseUint(data[0][1], 10, 64) qs.ReadBytes, _ = strconv.ParseUint(data[0][2], 10, 64) qs.WrittenRows, _ = strconv.ParseUint(data[0][3], 10, 64) diff --git a/helpers.go b/helpers.go index 407140b..904969e 100644 --- a/helpers.go +++ b/helpers.go @@ -3,8 +3,8 @@ package main import ( "bufio" "io" - "strings" "strconv" + "strings" ) func readTabSeparated(rd io.Reader) ([][]string, error) { diff --git a/output.go b/output.go index 6dfa20d..7734b92 100644 --- a/output.go +++ b/output.go @@ -4,11 +4,12 @@ import ( "bufio" "context" "fmt" - "github.com/mattn/go-colorable" // make colors work on windows "io" "os" "os/exec" "strings" + + "github.com/mattn/go-colorable" // make colors work on windows ) // TODO: errors @@ -73,10 +74,9 @@ func (output *outputStruct) setOutfile(filename string) { } } - output.printServiceMsg("File "+filename + " already exists or not writable. ") // TODO + output.printServiceMsg("File " + filename + " already exists or not writable. ") // TODO output.printServiceMsg("Will use STDOUT\n\n") - } func (output *outputStruct) reset() { @@ -87,7 +87,7 @@ func (output *outputStruct) reset() { output.pagerParams = []string{} } -func (output *outputStruct) setupOutput(cancel context.CancelFunc ) { +func (output *outputStruct) setupOutput(cancel context.CancelFunc) { switch output.outputMode { case omStd: output.StdOut = output.colorableStdOut @@ -107,7 +107,7 @@ func (output *outputStruct) setupOutput(cancel context.CancelFunc ) { defer cancel() err := cmd.Run() if err != nil { - output.printServiceMsg( fmt.Sprintf("Unable to start PAGER: %s\nPager disabled, STDOUT will be used", err)) + output.printServiceMsg(fmt.Sprintf("Unable to start PAGER: %s\nPager disabled, STDOUT will be used", err)) output.reset() } }() diff --git a/progressbar.go b/progressbar.go index bf093ff..a80d9dc 100644 --- a/progressbar.go +++ b/progressbar.go @@ -2,10 +2,11 @@ package main import ( "fmt" - "github.com/chzyer/readline" // only console width used from there... "io" "math" "strings" + + "github.com/chzyer/readline" // only console width used from there... ) /// http://en.wikipedia.org/wiki/ANSI_escape_code diff --git a/prompt_loop.go b/prompt_loop.go index 08a3590..3918ff3 100644 --- a/prompt_loop.go +++ b/prompt_loop.go @@ -1,12 +1,12 @@ package main import ( - "github.com/peterh/liner" // there is also github.com/chzyer/readline and https://github.com/Bowery/prompt - //"log" "os" "path/filepath" "regexp" "strings" + + "github.com/peterh/liner" // there is also github.com/chzyer/readline and https://github.com/Bowery/prompt ) var prompt = ":) "