实现文档版本比对功能
parent
077ddffa99
commit
60330602d4
2
main.go
2
main.go
|
@ -97,7 +97,7 @@ func main() {
|
|||
InitLogs()
|
||||
InitRedisConfig()
|
||||
InitMysql()
|
||||
InitElasticSearch()
|
||||
//InitElasticSearch()
|
||||
|
||||
//o := db.GetMongoDb()
|
||||
//mgo = mgo
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"testing"
|
||||
|
||||
"github.com/sergi/go-diff/diffmatchpatch"
|
||||
)
|
||||
|
||||
const (
|
||||
text1 = "Lorem ipsum dolor."
|
||||
text2 = "Lorem dolor sit amet. sdfsdfsd"
|
||||
)
|
||||
|
||||
func TestDiff(t *testing.T) {
|
||||
dmp := diffmatchpatch.New()
|
||||
|
||||
diffs := dmp.DiffMain(text1, text2, false)
|
||||
log.Print(diffs)
|
||||
prettydiff := dmp.DiffPrettyText(diffs)
|
||||
|
||||
log.Print(prettydiff)
|
||||
}
|
|
@ -8,6 +8,7 @@ import (
|
|||
"log"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func InitConfig() {
|
||||
e := config.Init("user.yaml")
|
||||
if nil != e {
|
||||
|
|
Loading…
Reference in New Issue