diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..b86c795
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,21 @@
+language: go
+
+matrix:
+ fast_finish: true
+ include:
+ - go: 1.11.x
+ env: GO111MODULE=on
+ - go: 1.12.x
+ env: GO111MODULE=on
+ - go: master
+ env: GO111MODULE=on
+
+before_install:
+ - if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fi
+
+install:
+ - if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else go install; fi
+ - if [[ "${GO111MODULE}" = "on" ]]; then export PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"; fi
+
+script:
+- make fmt
\ No newline at end of file
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..742ebca
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SOURCE_FILE := `find . -name "*.go" | grep -v "vendor/*"`
+
+fmt:
+ gofmt -s -w ${SOURCE_FILE} > /dev/null
\ No newline at end of file
diff --git a/README.md b/README.md
index f6de19c..49462e2 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,9 @@
go-redis-parser
-This is a parser in Golang. Its characteristics are: make full use of
-the coroutine language's coroutine, write at the same time as the file
-is written, more efficient analysis.
+A efficient and safe parser in Golang. Its characteristics are: make full use of
+the language's `goroutine`, write at the same time as the file is written. This
+important thing is that you can analyze without connecting to an online service.
```
@@ -34,17 +34,18 @@ Supports Redis from 2.8 to 5.0, all data types except module. Including:
- List
- Set
- SortedSed
-- Stream
+- **Stream(Redis 5.0 new data type)**
In addition to exporting all key/values, it also looks for all types of `Bigkeys` (like `redis-cli --bigkeys`).
### Installation
-`go-redis-parser` is a standard package,you can use `git` or `go get` to install.
+`go-redis-parser` will build a `binary file`,you can use `git` or `go get` to install.
#### via git
```
-$ git clone https://github.com/8090Lambert/go-redis-parser.git
+$ git clone https://github.com/8090Lambert/go-redis-parser.git && cd go-redis-parser
+$ go install
```
#### via go
@@ -53,8 +54,9 @@ $ go get github.com/8090Lambert/go-redis-parser
```
### Using
+Before using, you should set `export PATH=$PATH:$GOPATH/bin`
```
-$ go run main.go -rdb -o -type
+$ go-redis-parser -rdb -o -type
```
### Generate File
diff --git a/boot/boot.go b/boot/boot.go
index 8a80b26..c0b1481 100644
--- a/boot/boot.go
+++ b/boot/boot.go
@@ -35,9 +35,7 @@ func Boot() {
factory(file).Parse()
}
-type Factory func(file string) protocol.Parser
-
-func NewParserFactory(mod int) Factory {
+func NewParserFactory(mod int) protocol.Factory {
if mod == constants.RDBMOD {
return rdb.NewRDB
} else {
diff --git a/protocol/protocol.go b/protocol/protocol.go
index 6db2724..cd109c1 100644
--- a/protocol/protocol.go
+++ b/protocol/protocol.go
@@ -25,3 +25,5 @@ type TypeObject interface {
Type() string // Redis data type
ConcreteSize() uint64 // Data bytes size, except metadata
}
+
+type Factory func(file string) Parser