From eee7468b85f1e01e12515728e9ae28eca0dd77d8 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 4 May 2015 22:42:28 +0800 Subject: [PATCH] format with goimports --- cmd/ledis-benchmark/main.go | 3 ++- cmd/ledis-cli/const.go | 2 +- cmd/ledis-cli/main.go | 3 ++- cmd/ledis-dump/main.go | 3 ++- cmd/ledis-load/main.go | 1 + cmd/ledis-repair/main.go | 1 + cmd/ledis-server/main.go | 5 +++-- config/config.go | 5 +++-- ledis/batch.go | 3 ++- ledis/dump.go | 5 +++-- ledis/dump_test.go | 5 +++-- ledis/event.go | 3 ++- ledis/ledis.go | 11 ++++++----- ledis/ledis_db.go | 3 ++- ledis/ledis_test.go | 3 ++- ledis/migrate.go | 1 + ledis/migrate_test.go | 3 ++- ledis/replication.go | 5 +++-- ledis/replication_test.go | 5 +++-- ledis/scan.go | 3 ++- ledis/sort.go | 3 ++- ledis/t_hash.go | 3 ++- ledis/t_kv.go | 5 +++-- ledis/t_list.go | 5 +++-- ledis/t_set.go | 3 ++- ledis/t_ttl.go | 3 ++- ledis/t_ttl_test.go | 3 ++- ledis/t_zset.go | 3 ++- ledis/t_zset_test.go | 3 ++- ledis/util.go | 3 ++- rpl/file_io.go | 5 +++-- rpl/file_store.go | 7 ++++--- rpl/file_table.go | 5 +++-- rpl/file_table_test.go | 3 ++- rpl/goleveldb_store.go | 7 ++++--- rpl/rpl.go | 7 ++++--- rpl/rpl_test.go | 3 ++- rpl/store_test.go | 3 ++- server/app.go | 7 ++++--- server/app_test.go | 5 +++-- server/client.go | 5 +++-- server/client_http.go | 9 +++++---- server/client_resp.go | 11 ++++++----- server/cmd_hash_test.go | 3 ++- server/cmd_kv.go | 3 ++- server/cmd_kv_test.go | 3 ++- server/cmd_list.go | 5 +++-- server/cmd_list_test.go | 3 ++- server/cmd_migrate_test.go | 5 +++-- server/cmd_replication.go | 7 ++++--- server/cmd_replication_test.go | 5 +++-- server/cmd_scan.go | 5 +++-- server/cmd_scan_test.go | 5 +++-- server/cmd_script.go | 4 +++- server/cmd_script_test.go | 3 ++- server/cmd_server_test.go | 3 ++- server/cmd_set_test.go | 3 ++- server/cmd_sort_test.go | 3 ++- server/cmd_ttl_test.go | 3 ++- server/cmd_zset.go | 7 ++++--- server/cmd_zset_test.go | 3 ++- server/const.go | 1 + server/info.go | 3 ++- server/replication.go | 13 +++++++------ server/script.go | 5 +++-- server/script_test.go | 1 + server/snapshot.go | 5 +++-- server/snapshot_test.go | 3 ++- server/util.go | 2 -- store/boltdb/db.go | 5 +++-- store/db.go | 5 +++-- store/driver/store.go | 1 + store/iterator.go | 1 + store/leveldb/batch.go | 3 ++- store/leveldb/db.go | 5 +++-- store/mdb/mdb.go | 3 ++- store/rocksdb/db.go | 5 +++-- store/store.go | 5 +++-- store/store_test.go | 5 +++-- store/tx_test.go | 3 ++- store/writebatch.go | 3 ++- upgrade/ledis-upgrade-ttl/main.go | 1 + 82 files changed, 207 insertions(+), 128 deletions(-) diff --git a/cmd/ledis-benchmark/main.go b/cmd/ledis-benchmark/main.go index 918c7e4..06e2b61 100644 --- a/cmd/ledis-benchmark/main.go +++ b/cmd/ledis-benchmark/main.go @@ -3,13 +3,14 @@ package main import ( "flag" "fmt" - "github.com/siddontang/goredis" "math/rand" "runtime" "strings" "sync" "sync/atomic" "time" + + "github.com/siddontang/goredis" ) var ip = flag.String("ip", "127.0.0.1", "redis/ledis/ssdb server ip") diff --git a/cmd/ledis-cli/const.go b/cmd/ledis-cli/const.go index 79a04c0..21be6ed 100644 --- a/cmd/ledis-cli/const.go +++ b/cmd/ledis-cli/const.go @@ -1,4 +1,4 @@ -//This file was generated by .tools/generate_commands.py on Sat Mar 14 2015 08:58:32 +0800 +//This file was generated by .tools/generate_commands.py on Sat Mar 14 2015 08:58:32 +0800 package main var helpCommands = [][]string{ diff --git a/cmd/ledis-cli/main.go b/cmd/ledis-cli/main.go index 164d8ba..42355b8 100644 --- a/cmd/ledis-cli/main.go +++ b/cmd/ledis-cli/main.go @@ -5,10 +5,11 @@ package main import ( "flag" "fmt" - "github.com/siddontang/goredis" "regexp" "strconv" "strings" + + "github.com/siddontang/goredis" ) var ip = flag.String("h", "127.0.0.1", "ledisdb server ip (default 127.0.0.1)") diff --git a/cmd/ledis-dump/main.go b/cmd/ledis-dump/main.go index 7ecaffa..8bf49d5 100644 --- a/cmd/ledis-dump/main.go +++ b/cmd/ledis-dump/main.go @@ -3,8 +3,9 @@ package main import ( "flag" "fmt" - "github.com/siddontang/goredis" "os" + + "github.com/siddontang/goredis" ) var host = flag.String("host", "127.0.0.1", "ledis server host") diff --git a/cmd/ledis-load/main.go b/cmd/ledis-load/main.go index b9b6a9c..1daeaea 100644 --- a/cmd/ledis-load/main.go +++ b/cmd/ledis-load/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/ledis" ) diff --git a/cmd/ledis-repair/main.go b/cmd/ledis-repair/main.go index 23208df..e939201 100644 --- a/cmd/ledis-repair/main.go +++ b/cmd/ledis-repair/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/store" ) diff --git a/cmd/ledis-server/main.go b/cmd/ledis-server/main.go index d8d3d9c..285fea5 100644 --- a/cmd/ledis-server/main.go +++ b/cmd/ledis-server/main.go @@ -3,8 +3,6 @@ package main import ( "flag" "fmt" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/server" "log" "net/http" _ "net/http/pprof" @@ -13,6 +11,9 @@ import ( "runtime" "strings" "syscall" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/server" ) var configFile = flag.String("config", "", "ledisdb config file") diff --git a/config/config.go b/config/config.go index 6ff5242..390b96c 100644 --- a/config/config.go +++ b/config/config.go @@ -3,11 +3,12 @@ package config import ( "bytes" "errors" - "github.com/BurntSushi/toml" - "github.com/siddontang/go/ioutil2" "io" "io/ioutil" "sync" + + "github.com/BurntSushi/toml" + "github.com/siddontang/go/ioutil2" ) var ( diff --git a/ledis/batch.go b/ledis/batch.go index b3f2140..6800dfe 100644 --- a/ledis/batch.go +++ b/ledis/batch.go @@ -1,10 +1,11 @@ package ledis import ( + "sync" + "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/store" - "sync" ) type batch struct { diff --git a/ledis/dump.go b/ledis/dump.go index 863255c..9ec66b9 100644 --- a/ledis/dump.go +++ b/ledis/dump.go @@ -4,10 +4,11 @@ import ( "bufio" "bytes" "encoding/binary" - "github.com/siddontang/go/snappy" - "github.com/siddontang/ledisdb/store" "io" "os" + + "github.com/siddontang/go/snappy" + "github.com/siddontang/ledisdb/store" ) type DumpHead struct { diff --git a/ledis/dump_test.go b/ledis/dump_test.go index 30c7ba5..2c0d97f 100644 --- a/ledis/dump_test.go +++ b/ledis/dump_test.go @@ -2,10 +2,11 @@ package ledis import ( "bytes" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store" "os" "testing" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store" ) func TestDump(t *testing.T) { diff --git a/ledis/event.go b/ledis/event.go index 1f5b792..e7a175c 100644 --- a/ledis/event.go +++ b/ledis/event.go @@ -3,8 +3,9 @@ package ledis import ( "errors" "fmt" - "github.com/siddontang/go/hack" "strconv" + + "github.com/siddontang/go/hack" ) var errInvalidEvent = errors.New("invalid event") diff --git a/ledis/ledis.go b/ledis/ledis.go index 5a4fc8d..5bc0ab4 100644 --- a/ledis/ledis.go +++ b/ledis/ledis.go @@ -2,16 +2,17 @@ package ledis import ( "fmt" - "github.com/siddontang/go/filelock" - "github.com/siddontang/go/log" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/rpl" - "github.com/siddontang/ledisdb/store" "io" "os" "path" "sync" "time" + + "github.com/siddontang/go/filelock" + "github.com/siddontang/go/log" + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/rpl" + "github.com/siddontang/ledisdb/store" ) type Ledis struct { diff --git a/ledis/ledis_db.go b/ledis/ledis_db.go index 3ceeaae..7b3ff0f 100644 --- a/ledis/ledis_db.go +++ b/ledis/ledis_db.go @@ -4,8 +4,9 @@ import ( "bytes" "encoding/binary" "fmt" - "github.com/siddontang/ledisdb/store" "sync" + + "github.com/siddontang/ledisdb/store" ) type ibucket interface { diff --git a/ledis/ledis_test.go b/ledis/ledis_test.go index de308e7..b9c38bd 100644 --- a/ledis/ledis_test.go +++ b/ledis/ledis_test.go @@ -1,10 +1,11 @@ package ledis import ( - "github.com/siddontang/ledisdb/config" "os" "sync" "testing" + + "github.com/siddontang/ledisdb/config" ) var testLedis *Ledis diff --git a/ledis/migrate.go b/ledis/migrate.go index 0db22b4..aca8a86 100644 --- a/ledis/migrate.go +++ b/ledis/migrate.go @@ -2,6 +2,7 @@ package ledis import ( "fmt" + "github.com/siddontang/rdb" ) diff --git a/ledis/migrate_test.go b/ledis/migrate_test.go index 697fe36..50a9619 100644 --- a/ledis/migrate_test.go +++ b/ledis/migrate_test.go @@ -1,9 +1,10 @@ package ledis import ( - "github.com/siddontang/ledisdb/config" "os" "testing" + + "github.com/siddontang/ledisdb/config" ) func TestMigrate(t *testing.T) { diff --git a/ledis/replication.go b/ledis/replication.go index b8055db..04f7927 100644 --- a/ledis/replication.go +++ b/ledis/replication.go @@ -3,12 +3,13 @@ package ledis import ( "bytes" "errors" + "io" + "time" + "github.com/siddontang/go/log" "github.com/siddontang/go/snappy" "github.com/siddontang/ledisdb/rpl" "github.com/siddontang/ledisdb/store" - "io" - "time" ) const ( diff --git a/ledis/replication_test.go b/ledis/replication_test.go index 5adaa60..1a95fba 100644 --- a/ledis/replication_test.go +++ b/ledis/replication_test.go @@ -3,10 +3,11 @@ package ledis import ( "bytes" "fmt" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store" "os" "testing" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store" ) func checkLedisEqual(master *Ledis, slave *Ledis) error { diff --git a/ledis/scan.go b/ledis/scan.go index 94bff5d..c4540a6 100644 --- a/ledis/scan.go +++ b/ledis/scan.go @@ -2,8 +2,9 @@ package ledis import ( "errors" - "github.com/siddontang/ledisdb/store" "regexp" + + "github.com/siddontang/ledisdb/store" ) var errDataType = errors.New("error data type") diff --git a/ledis/sort.go b/ledis/sort.go index cfd8b10..6a54c07 100644 --- a/ledis/sort.go +++ b/ledis/sort.go @@ -3,9 +3,10 @@ package ledis import ( "bytes" "fmt" - "github.com/siddontang/ledisdb/store" "sort" "strconv" + + "github.com/siddontang/ledisdb/store" ) type Limit struct { diff --git a/ledis/t_hash.go b/ledis/t_hash.go index 9914ea8..c822e23 100644 --- a/ledis/t_hash.go +++ b/ledis/t_hash.go @@ -3,9 +3,10 @@ package ledis import ( "encoding/binary" "errors" + "time" + "github.com/siddontang/go/num" "github.com/siddontang/ledisdb/store" - "time" ) type FVPair struct { diff --git a/ledis/t_kv.go b/ledis/t_kv.go index 8c85c52..ca32310 100644 --- a/ledis/t_kv.go +++ b/ledis/t_kv.go @@ -4,10 +4,11 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/siddontang/go/num" - "github.com/siddontang/ledisdb/store" "strings" "time" + + "github.com/siddontang/go/num" + "github.com/siddontang/ledisdb/store" ) type KVPair struct { diff --git a/ledis/t_list.go b/ledis/t_list.go index c872c7b..d59a2c8 100644 --- a/ledis/t_list.go +++ b/ledis/t_list.go @@ -4,10 +4,11 @@ import ( "container/list" "encoding/binary" "errors" - "github.com/siddontang/go/hack" - "github.com/siddontang/ledisdb/store" "sync" "time" + + "github.com/siddontang/go/hack" + "github.com/siddontang/ledisdb/store" ) const ( diff --git a/ledis/t_set.go b/ledis/t_set.go index 998170a..a4eaf95 100644 --- a/ledis/t_set.go +++ b/ledis/t_set.go @@ -3,9 +3,10 @@ package ledis import ( "encoding/binary" "errors" + "time" + "github.com/siddontang/go/hack" "github.com/siddontang/ledisdb/store" - "time" ) var errSetKey = errors.New("invalid set key") diff --git a/ledis/t_ttl.go b/ledis/t_ttl.go index 2785a1d..2c979ae 100644 --- a/ledis/t_ttl.go +++ b/ledis/t_ttl.go @@ -3,9 +3,10 @@ package ledis import ( "encoding/binary" "errors" - "github.com/siddontang/ledisdb/store" "sync" "time" + + "github.com/siddontang/ledisdb/store" ) var ( diff --git a/ledis/t_ttl_test.go b/ledis/t_ttl_test.go index f261399..1c54a29 100644 --- a/ledis/t_ttl_test.go +++ b/ledis/t_ttl_test.go @@ -2,10 +2,11 @@ package ledis import ( "fmt" - "github.com/siddontang/go/hack" "sync" "testing" "time" + + "github.com/siddontang/go/hack" ) var m sync.Mutex diff --git a/ledis/t_zset.go b/ledis/t_zset.go index 6b65f4d..7cf753a 100644 --- a/ledis/t_zset.go +++ b/ledis/t_zset.go @@ -4,9 +4,10 @@ import ( "bytes" "encoding/binary" "errors" + "time" + "github.com/siddontang/go/hack" "github.com/siddontang/ledisdb/store" - "time" ) const ( diff --git a/ledis/t_zset_test.go b/ledis/t_zset_test.go index f2bc7ee..cc0c2b6 100644 --- a/ledis/t_zset_test.go +++ b/ledis/t_zset_test.go @@ -2,9 +2,10 @@ package ledis import ( "fmt" - "github.com/siddontang/ledisdb/store" "reflect" "testing" + + "github.com/siddontang/ledisdb/store" ) const ( diff --git a/ledis/util.go b/ledis/util.go index a0abdd0..26ee6d0 100644 --- a/ledis/util.go +++ b/ledis/util.go @@ -3,8 +3,9 @@ package ledis import ( "encoding/binary" "errors" - "github.com/siddontang/go/hack" "strconv" + + "github.com/siddontang/go/hack" ) var errIntNumber = errors.New("invalid integer") diff --git a/rpl/file_io.go b/rpl/file_io.go index bca6604..6eac878 100644 --- a/rpl/file_io.go +++ b/rpl/file_io.go @@ -2,10 +2,11 @@ package rpl import ( "fmt" - "github.com/edsrzf/mmap-go" - "github.com/siddontang/go/log" "io" "os" + + "github.com/edsrzf/mmap-go" + "github.com/siddontang/go/log" ) //like leveldb or rocksdb file interface, haha! diff --git a/rpl/file_store.go b/rpl/file_store.go index 0a9f390..f6f708b 100644 --- a/rpl/file_store.go +++ b/rpl/file_store.go @@ -2,14 +2,15 @@ package rpl import ( "fmt" - "github.com/siddontang/go/log" - "github.com/siddontang/go/num" - "github.com/siddontang/ledisdb/config" "io/ioutil" "os" "sort" "sync" "time" + + "github.com/siddontang/go/log" + "github.com/siddontang/go/num" + "github.com/siddontang/ledisdb/config" ) const ( diff --git a/rpl/file_table.go b/rpl/file_table.go index 1718a3b..9658102 100644 --- a/rpl/file_table.go +++ b/rpl/file_table.go @@ -5,12 +5,13 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/siddontang/go/log" - "github.com/siddontang/go/sync2" "io" "path" "sync" "time" + + "github.com/siddontang/go/log" + "github.com/siddontang/go/sync2" ) var ( diff --git a/rpl/file_table_test.go b/rpl/file_table_test.go index e020c8a..284488e 100644 --- a/rpl/file_table_test.go +++ b/rpl/file_table_test.go @@ -1,12 +1,13 @@ package rpl import ( - "github.com/siddontang/go/log" "io/ioutil" "os" "path" "testing" "time" + + "github.com/siddontang/go/log" ) func TestFileTable(t *testing.T) { diff --git a/rpl/goleveldb_store.go b/rpl/goleveldb_store.go index 5ece8d5..445c17c 100644 --- a/rpl/goleveldb_store.go +++ b/rpl/goleveldb_store.go @@ -3,12 +3,13 @@ package rpl import ( "bytes" "fmt" - "github.com/siddontang/go/num" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store" "os" "sync" "time" + + "github.com/siddontang/go/num" + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store" ) type GoLevelDBStore struct { diff --git a/rpl/rpl.go b/rpl/rpl.go index 96efd23..29f8880 100644 --- a/rpl/rpl.go +++ b/rpl/rpl.go @@ -2,13 +2,14 @@ package rpl import ( "encoding/binary" - "github.com/siddontang/go/log" - "github.com/siddontang/go/snappy" - "github.com/siddontang/ledisdb/config" "os" "path" "sync" "time" + + "github.com/siddontang/go/log" + "github.com/siddontang/go/snappy" + "github.com/siddontang/ledisdb/config" ) type Stat struct { diff --git a/rpl/rpl_test.go b/rpl/rpl_test.go index 63ff427..cd059f3 100644 --- a/rpl/rpl_test.go +++ b/rpl/rpl_test.go @@ -1,10 +1,11 @@ package rpl import ( - "github.com/siddontang/ledisdb/config" "io/ioutil" "os" "testing" + + "github.com/siddontang/ledisdb/config" ) func TestReplication(t *testing.T) { diff --git a/rpl/store_test.go b/rpl/store_test.go index 9b8febe..99bd2a5 100644 --- a/rpl/store_test.go +++ b/rpl/store_test.go @@ -1,10 +1,11 @@ package rpl import ( - "github.com/siddontang/ledisdb/config" "io/ioutil" "os" "testing" + + "github.com/siddontang/ledisdb/config" ) func TestGoLevelDBStore(t *testing.T) { diff --git a/server/app.go b/server/app.go index cca63bd..e0e8e97 100644 --- a/server/app.go +++ b/server/app.go @@ -1,14 +1,15 @@ package server import ( - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/ledis" "net" "net/http" "path" "strings" "sync" + + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/ledis" ) type App struct { diff --git a/server/app_test.go b/server/app_test.go index 6347cbc..f182e8e 100644 --- a/server/app_test.go +++ b/server/app_test.go @@ -1,11 +1,12 @@ package server import ( - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/config" "os" "sync" "testing" + + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/config" ) var testAppOnce sync.Once diff --git a/server/client.go b/server/client.go index 110d42e..0156d16 100644 --- a/server/client.go +++ b/server/client.go @@ -3,10 +3,11 @@ package server import ( "bytes" // "fmt" - "github.com/siddontang/go/sync2" - "github.com/siddontang/ledisdb/ledis" "io" "time" + + "github.com/siddontang/go/sync2" + "github.com/siddontang/ledisdb/ledis" ) // var txUnsupportedCmds = map[string]struct{}{ diff --git a/server/client_http.go b/server/client_http.go index fd11518..0496abe 100644 --- a/server/client_http.go +++ b/server/client_http.go @@ -3,15 +3,16 @@ package server import ( "encoding/json" "fmt" + "io" + "net/http" + "strconv" + "strings" + "github.com/siddontang/go/bson" "github.com/siddontang/go/hack" "github.com/siddontang/go/log" "github.com/siddontang/ledisdb/ledis" "github.com/ugorji/go/codec" - "io" - "net/http" - "strconv" - "strings" ) var allowedContentTypes = map[string]struct{}{ diff --git a/server/client_resp.go b/server/client_resp.go index 65b8b97..3145875 100644 --- a/server/client_resp.go +++ b/server/client_resp.go @@ -4,17 +4,18 @@ import ( "bufio" "errors" "fmt" - "github.com/siddontang/go/hack" - "github.com/siddontang/go/log" - "github.com/siddontang/go/num" - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/ledis" "io" "net" "runtime" "strconv" "syscall" "time" + + "github.com/siddontang/go/hack" + "github.com/siddontang/go/log" + "github.com/siddontang/go/num" + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/ledis" ) var errReadRequest = errors.New("invalid request protocol") diff --git a/server/cmd_hash_test.go b/server/cmd_hash_test.go index 847597a..f9d19be 100644 --- a/server/cmd_hash_test.go +++ b/server/cmd_hash_test.go @@ -2,9 +2,10 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "strconv" "testing" + + "github.com/siddontang/goredis" ) func TestHash(t *testing.T) { diff --git a/server/cmd_kv.go b/server/cmd_kv.go index 25d7bb9..051cead 100644 --- a/server/cmd_kv.go +++ b/server/cmd_kv.go @@ -1,8 +1,9 @@ package server import ( - "github.com/siddontang/ledisdb/ledis" "strconv" + + "github.com/siddontang/ledisdb/ledis" ) // func getCommand(c *client) error { diff --git a/server/cmd_kv_test.go b/server/cmd_kv_test.go index a196155..6e8cf9d 100644 --- a/server/cmd_kv_test.go +++ b/server/cmd_kv_test.go @@ -1,8 +1,9 @@ package server import ( - "github.com/siddontang/goredis" "testing" + + "github.com/siddontang/goredis" ) func TestKV(t *testing.T) { diff --git a/server/cmd_list.go b/server/cmd_list.go index 3d96a4c..4934621 100644 --- a/server/cmd_list.go +++ b/server/cmd_list.go @@ -1,10 +1,11 @@ package server import ( - "github.com/siddontang/go/hack" - "github.com/siddontang/ledisdb/ledis" "strconv" "time" + + "github.com/siddontang/go/hack" + "github.com/siddontang/ledisdb/ledis" ) func lpushCommand(c *client) error { diff --git a/server/cmd_list_test.go b/server/cmd_list_test.go index 66f1a75..3386d43 100644 --- a/server/cmd_list_test.go +++ b/server/cmd_list_test.go @@ -2,9 +2,10 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "strconv" "testing" + + "github.com/siddontang/goredis" ) func testListIndex(key []byte, index int64, v int) error { diff --git a/server/cmd_migrate_test.go b/server/cmd_migrate_test.go index 45dcea1..18f4fdc 100644 --- a/server/cmd_migrate_test.go +++ b/server/cmd_migrate_test.go @@ -2,11 +2,12 @@ package server import ( "fmt" - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/config" "os" "testing" "time" + + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/config" ) func TestDumpRestore(t *testing.T) { diff --git a/server/cmd_replication.go b/server/cmd_replication.go index 390530e..62c1f1b 100644 --- a/server/cmd_replication.go +++ b/server/cmd_replication.go @@ -3,13 +3,14 @@ package server import ( "encoding/binary" "fmt" - "github.com/siddontang/go/hack" - "github.com/siddontang/go/num" - "github.com/siddontang/ledisdb/ledis" "net" "strconv" "strings" "time" + + "github.com/siddontang/go/hack" + "github.com/siddontang/go/num" + "github.com/siddontang/ledisdb/ledis" ) func slaveofCommand(c *client) error { diff --git a/server/cmd_replication_test.go b/server/cmd_replication_test.go index c614122..23e4b76 100644 --- a/server/cmd_replication_test.go +++ b/server/cmd_replication_test.go @@ -2,12 +2,13 @@ package server import ( "fmt" - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/config" "os" "reflect" "testing" "time" + + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/config" ) func checkDataEqual(master *App, slave *App) error { diff --git a/server/cmd_scan.go b/server/cmd_scan.go index dc579c4..0257948 100644 --- a/server/cmd_scan.go +++ b/server/cmd_scan.go @@ -2,11 +2,12 @@ package server import ( "fmt" + "strconv" + "strings" + "github.com/siddontang/go/hack" "github.com/siddontang/go/num" "github.com/siddontang/ledisdb/ledis" - "strconv" - "strings" ) func parseScanArgs(args [][]byte) (cursor []byte, match string, count int, desc bool, err error) { diff --git a/server/cmd_scan_test.go b/server/cmd_scan_test.go index a5c634c..50dcbdf 100644 --- a/server/cmd_scan_test.go +++ b/server/cmd_scan_test.go @@ -2,10 +2,11 @@ package server import ( "fmt" - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/config" "os" "testing" + + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/config" ) func TestScan(t *testing.T) { diff --git a/server/cmd_script.go b/server/cmd_script.go index 1148fa9..e299aa7 100644 --- a/server/cmd_script.go +++ b/server/cmd_script.go @@ -6,11 +6,13 @@ import ( "crypto/sha1" "encoding/hex" "fmt" + "github.com/siddontang/go/hack" - "github.com/siddontang/ledisdb/vendor/lua" "strconv" "strings" + + "github.com/siddontang/ledisdb/vendor/lua" ) func parseEvalArgs(l *lua.State, c *client) error { diff --git a/server/cmd_script_test.go b/server/cmd_script_test.go index 56f8cec..e5ed2b8 100644 --- a/server/cmd_script_test.go +++ b/server/cmd_script_test.go @@ -4,9 +4,10 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "reflect" "testing" + + "github.com/siddontang/goredis" ) func TestCmdEval(t *testing.T) { diff --git a/server/cmd_server_test.go b/server/cmd_server_test.go index ca283dc..325d602 100644 --- a/server/cmd_server_test.go +++ b/server/cmd_server_test.go @@ -1,8 +1,9 @@ package server import ( - "github.com/siddontang/goredis" "testing" + + "github.com/siddontang/goredis" ) func TestXSelect(t *testing.T) { diff --git a/server/cmd_set_test.go b/server/cmd_set_test.go index 2846779..ed9d067 100644 --- a/server/cmd_set_test.go +++ b/server/cmd_set_test.go @@ -1,8 +1,9 @@ package server import ( - "github.com/siddontang/goredis" "testing" + + "github.com/siddontang/goredis" ) func TestSet(t *testing.T) { diff --git a/server/cmd_sort_test.go b/server/cmd_sort_test.go index ea5948d..9ca5ebc 100644 --- a/server/cmd_sort_test.go +++ b/server/cmd_sort_test.go @@ -2,8 +2,9 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "testing" + + "github.com/siddontang/goredis" ) func checkTestSortRes(ay interface{}, checks []string) error { diff --git a/server/cmd_ttl_test.go b/server/cmd_ttl_test.go index 0630ca2..f9c84bd 100644 --- a/server/cmd_ttl_test.go +++ b/server/cmd_ttl_test.go @@ -2,9 +2,10 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "testing" "time" + + "github.com/siddontang/goredis" ) func now() int64 { diff --git a/server/cmd_zset.go b/server/cmd_zset.go index 9c6fdac..057a293 100644 --- a/server/cmd_zset.go +++ b/server/cmd_zset.go @@ -2,13 +2,14 @@ package server import ( "errors" + "math" + "strconv" + "strings" + "github.com/siddontang/go/hack" "github.com/siddontang/go/num" "github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/store" - "math" - "strconv" - "strings" ) //for simple implementation, we only support int64 score diff --git a/server/cmd_zset_test.go b/server/cmd_zset_test.go index 68d7fa7..b0f4a55 100644 --- a/server/cmd_zset_test.go +++ b/server/cmd_zset_test.go @@ -2,10 +2,11 @@ package server import ( "fmt" - "github.com/siddontang/goredis" "reflect" "strconv" "testing" + + "github.com/siddontang/goredis" ) func TestZSet(t *testing.T) { diff --git a/server/const.go b/server/const.go index d5c7308..73fc6a0 100644 --- a/server/const.go +++ b/server/const.go @@ -2,6 +2,7 @@ package server import ( "errors" + "github.com/siddontang/ledisdb/ledis" ) diff --git a/server/info.go b/server/info.go index ef4d089..c93fb34 100644 --- a/server/info.go +++ b/server/info.go @@ -3,13 +3,14 @@ package server import ( "bytes" "fmt" - "github.com/siddontang/go/sync2" "os" "runtime" "runtime/debug" "strings" "sync" "time" + + "github.com/siddontang/go/sync2" ) type info struct { diff --git a/server/replication.go b/server/replication.go index 2747e14..cfc4f26 100644 --- a/server/replication.go +++ b/server/replication.go @@ -4,18 +4,19 @@ import ( "bytes" "errors" "fmt" - "github.com/siddontang/go/log" - "github.com/siddontang/go/num" - "github.com/siddontang/go/sync2" - "github.com/siddontang/goredis" - "github.com/siddontang/ledisdb/ledis" - "github.com/siddontang/ledisdb/rpl" "net" "os" "path" "strings" "sync" "time" + + "github.com/siddontang/go/log" + "github.com/siddontang/go/num" + "github.com/siddontang/go/sync2" + "github.com/siddontang/goredis" + "github.com/siddontang/ledisdb/ledis" + "github.com/siddontang/ledisdb/rpl" ) var ( diff --git a/server/script.go b/server/script.go index fb10924..d15dfbd 100644 --- a/server/script.go +++ b/server/script.go @@ -5,12 +5,13 @@ package server import ( "encoding/hex" "fmt" + "io" + "sync" + "github.com/siddontang/go/hack" "github.com/siddontang/go/num" "github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/vendor/lua" - "io" - "sync" ) //ledis <-> lua type conversion, same as http://redis.io/commands/eval diff --git a/server/script_test.go b/server/script_test.go index f127876..cc19eb7 100644 --- a/server/script_test.go +++ b/server/script_test.go @@ -4,6 +4,7 @@ package server import ( "fmt" + "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/vendor/lua" diff --git a/server/snapshot.go b/server/snapshot.go index 9887094..b02b3f4 100644 --- a/server/snapshot.go +++ b/server/snapshot.go @@ -2,8 +2,6 @@ package server import ( "fmt" - "github.com/siddontang/go/log" - "github.com/siddontang/ledisdb/config" "io" "io/ioutil" "os" @@ -11,6 +9,9 @@ import ( "sort" "sync" "time" + + "github.com/siddontang/go/log" + "github.com/siddontang/ledisdb/config" ) const ( diff --git a/server/snapshot_test.go b/server/snapshot_test.go index e3ff625..7c8f19c 100644 --- a/server/snapshot_test.go +++ b/server/snapshot_test.go @@ -1,12 +1,13 @@ package server import ( - "github.com/siddontang/ledisdb/config" "io" "io/ioutil" "os" "path" "testing" + + "github.com/siddontang/ledisdb/config" ) type testSnapshotDumper struct { diff --git a/server/util.go b/server/util.go index f4fe490..8e51d9e 100644 --- a/server/util.go +++ b/server/util.go @@ -1,7 +1,5 @@ package server -import () - func lowerSlice(buf []byte) []byte { for i, r := range buf { if 'A' <= r && r <= 'Z' { diff --git a/store/boltdb/db.go b/store/boltdb/db.go index ac8cc03..350eef5 100644 --- a/store/boltdb/db.go +++ b/store/boltdb/db.go @@ -1,11 +1,12 @@ package boltdb import ( + "os" + "path" + "github.com/boltdb/bolt" "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/store/driver" - "os" - "path" ) var bucketName = []byte("ledisdb") diff --git a/store/db.go b/store/db.go index 9964c5e..5e09f26 100644 --- a/store/db.go +++ b/store/db.go @@ -1,10 +1,11 @@ package store import ( - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store/driver" "sync" "time" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store/driver" ) type DB struct { diff --git a/store/driver/store.go b/store/driver/store.go index dffa670..2116696 100644 --- a/store/driver/store.go +++ b/store/driver/store.go @@ -2,6 +2,7 @@ package driver import ( "fmt" + "github.com/siddontang/ledisdb/config" ) diff --git a/store/iterator.go b/store/iterator.go index d81976b..12a03b6 100644 --- a/store/iterator.go +++ b/store/iterator.go @@ -2,6 +2,7 @@ package store import ( "bytes" + "github.com/siddontang/ledisdb/store/driver" ) diff --git a/store/leveldb/batch.go b/store/leveldb/batch.go index 027aa39..9f5a076 100644 --- a/store/leveldb/batch.go +++ b/store/leveldb/batch.go @@ -8,8 +8,9 @@ package leveldb import "C" import ( - "github.com/syndtr/goleveldb/leveldb" "unsafe" + + "github.com/syndtr/goleveldb/leveldb" ) type WriteBatch struct { diff --git a/store/leveldb/db.go b/store/leveldb/db.go index 64bbc2b..2b6bf53 100644 --- a/store/leveldb/db.go +++ b/store/leveldb/db.go @@ -11,11 +11,12 @@ package leveldb import "C" import ( - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store/driver" "os" "runtime" "unsafe" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store/driver" ) const defaultFilterBits int = 10 diff --git a/store/mdb/mdb.go b/store/mdb/mdb.go index 21a2047..262bd20 100644 --- a/store/mdb/mdb.go +++ b/store/mdb/mdb.go @@ -3,10 +3,11 @@ package mdb import ( + "os" + "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/store/driver" mdb "github.com/siddontang/ledisdb/vendor/gomdb" - "os" ) type Store struct { diff --git a/store/rocksdb/db.go b/store/rocksdb/db.go index 952121b..8b97e18 100644 --- a/store/rocksdb/db.go +++ b/store/rocksdb/db.go @@ -12,11 +12,12 @@ package rocksdb import "C" import ( - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store/driver" "os" "runtime" "unsafe" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store/driver" ) const defaultFilterBits int = 10 diff --git a/store/store.go b/store/store.go index d1be9b0..dbe843a 100644 --- a/store/store.go +++ b/store/store.go @@ -2,11 +2,12 @@ package store import ( "fmt" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store/driver" "os" "path" + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store/driver" + _ "github.com/siddontang/ledisdb/store/boltdb" _ "github.com/siddontang/ledisdb/store/goleveldb" _ "github.com/siddontang/ledisdb/store/leveldb" diff --git a/store/store_test.go b/store/store_test.go index 9045ce2..7a3fe5f 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -3,11 +3,12 @@ package store import ( "bytes" "fmt" - "github.com/siddontang/ledisdb/config" - "github.com/siddontang/ledisdb/store/driver" "os" "reflect" "testing" + + "github.com/siddontang/ledisdb/config" + "github.com/siddontang/ledisdb/store/driver" ) func TestStore(t *testing.T) { diff --git a/store/tx_test.go b/store/tx_test.go index 1f89436..7f982d0 100644 --- a/store/tx_test.go +++ b/store/tx_test.go @@ -1,8 +1,9 @@ package store import ( - "github.com/siddontang/ledisdb/store/driver" "testing" + + "github.com/siddontang/ledisdb/store/driver" ) func TestTx(t *testing.T) { diff --git a/store/writebatch.go b/store/writebatch.go index c193ae0..329bca1 100644 --- a/store/writebatch.go +++ b/store/writebatch.go @@ -2,9 +2,10 @@ package store import ( "encoding/binary" + "time" + "github.com/siddontang/ledisdb/store/driver" "github.com/syndtr/goleveldb/leveldb" - "time" ) type WriteBatch struct { diff --git a/upgrade/ledis-upgrade-ttl/main.go b/upgrade/ledis-upgrade-ttl/main.go index b450b14..70a4ec2 100644 --- a/upgrade/ledis-upgrade-ttl/main.go +++ b/upgrade/ledis-upgrade-ttl/main.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "flag" "fmt" + "github.com/siddontang/ledisdb/config" "github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/store"