format with goimports

This commit is contained in:
siddontang 2015-05-04 22:42:28 +08:00
parent 9fdda1028e
commit eee7468b85
82 changed files with 207 additions and 128 deletions

View File

@ -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")

View File

@ -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{

View File

@ -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)")

View File

@ -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")

View File

@ -2,6 +2,7 @@ package main
import (
"flag"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis"
)

View File

@ -2,6 +2,7 @@ package main
import (
"flag"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/store"
)

View File

@ -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")

View File

@ -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 (

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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")

View File

@ -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 {

View File

@ -4,8 +4,9 @@ import (
"bytes"
"encoding/binary"
"fmt"
"github.com/siddontang/ledisdb/store"
"sync"
"github.com/siddontang/ledisdb/store"
)
type ibucket interface {

View File

@ -1,10 +1,11 @@
package ledis
import (
"github.com/siddontang/ledisdb/config"
"os"
"sync"
"testing"
"github.com/siddontang/ledisdb/config"
)
var testLedis *Ledis

View File

@ -2,6 +2,7 @@ package ledis
import (
"fmt"
"github.com/siddontang/rdb"
)

View File

@ -1,9 +1,10 @@
package ledis
import (
"github.com/siddontang/ledisdb/config"
"os"
"testing"
"github.com/siddontang/ledisdb/config"
)
func TestMigrate(t *testing.T) {

View File

@ -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 (

View File

@ -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 {

View File

@ -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")

View File

@ -3,9 +3,10 @@ package ledis
import (
"bytes"
"fmt"
"github.com/siddontang/ledisdb/store"
"sort"
"strconv"
"github.com/siddontang/ledisdb/store"
)
type Limit struct {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 (

View File

@ -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")

View File

@ -3,9 +3,10 @@ package ledis
import (
"encoding/binary"
"errors"
"github.com/siddontang/ledisdb/store"
"sync"
"time"
"github.com/siddontang/ledisdb/store"
)
var (

View File

@ -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

View File

@ -4,9 +4,10 @@ import (
"bytes"
"encoding/binary"
"errors"
"time"
"github.com/siddontang/go/hack"
"github.com/siddontang/ledisdb/store"
"time"
)
const (

View File

@ -2,9 +2,10 @@ package ledis
import (
"fmt"
"github.com/siddontang/ledisdb/store"
"reflect"
"testing"
"github.com/siddontang/ledisdb/store"
)
const (

View File

@ -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")

View File

@ -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!

View File

@ -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 (

View File

@ -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 (

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -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

View File

@ -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{}{

View File

@ -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{}{

View File

@ -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")

View File

@ -2,9 +2,10 @@ package server
import (
"fmt"
"github.com/siddontang/goredis"
"strconv"
"testing"
"github.com/siddontang/goredis"
)
func TestHash(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server
import (
"github.com/siddontang/ledisdb/ledis"
"strconv"
"github.com/siddontang/ledisdb/ledis"
)
// func getCommand(c *client) error {

View File

@ -1,8 +1,9 @@
package server
import (
"github.com/siddontang/goredis"
"testing"
"github.com/siddontang/goredis"
)
func TestKV(t *testing.T) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -4,9 +4,10 @@ package server
import (
"fmt"
"github.com/siddontang/goredis"
"reflect"
"testing"
"github.com/siddontang/goredis"
)
func TestCmdEval(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server
import (
"github.com/siddontang/goredis"
"testing"
"github.com/siddontang/goredis"
)
func TestXSelect(t *testing.T) {

View File

@ -1,8 +1,9 @@
package server
import (
"github.com/siddontang/goredis"
"testing"
"github.com/siddontang/goredis"
)
func TestSet(t *testing.T) {

View File

@ -2,8 +2,9 @@ package server
import (
"fmt"
"github.com/siddontang/goredis"
"testing"
"github.com/siddontang/goredis"
)
func checkTestSortRes(ay interface{}, checks []string) error {

View File

@ -2,9 +2,10 @@ package server
import (
"fmt"
"github.com/siddontang/goredis"
"testing"
"time"
"github.com/siddontang/goredis"
)
func now() int64 {

View File

@ -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

View File

@ -2,10 +2,11 @@ package server
import (
"fmt"
"github.com/siddontang/goredis"
"reflect"
"strconv"
"testing"
"github.com/siddontang/goredis"
)
func TestZSet(t *testing.T) {

View File

@ -2,6 +2,7 @@ package server
import (
"errors"
"github.com/siddontang/ledisdb/ledis"
)

View File

@ -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 {

View File

@ -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 (

View File

@ -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

View File

@ -4,6 +4,7 @@ package server
import (
"fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/vendor/lua"

View File

@ -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 (

View File

@ -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 {

View File

@ -1,7 +1,5 @@
package server
import ()
func lowerSlice(buf []byte) []byte {
for i, r := range buf {
if 'A' <= r && r <= 'Z' {

View File

@ -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")

View File

@ -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 {

View File

@ -2,6 +2,7 @@ package driver
import (
"fmt"
"github.com/siddontang/ledisdb/config"
)

View File

@ -2,6 +2,7 @@ package store
import (
"bytes"
"github.com/siddontang/ledisdb/store/driver"
)

View File

@ -8,8 +8,9 @@ package leveldb
import "C"
import (
"github.com/syndtr/goleveldb/leveldb"
"unsafe"
"github.com/syndtr/goleveldb/leveldb"
)
type WriteBatch struct {

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -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"

View File

@ -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) {

View File

@ -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) {

View File

@ -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 {

View File

@ -4,6 +4,7 @@ import (
"encoding/binary"
"flag"
"fmt"
"github.com/siddontang/ledisdb/config"
"github.com/siddontang/ledisdb/ledis"
"github.com/siddontang/ledisdb/store"