Skip to content

Commit

Permalink
update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Nov 30, 2017
1 parent 27ef6f7 commit 5cc4d5f
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 63 deletions.
8 changes: 4 additions & 4 deletions data/riot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ import (
var (
// searcher is coroutine safe
searcher = riot.Engine{}
)

// var config rpc.Config
var config com.Config
var wg sync.WaitGroup
// config rpc.Config
config com.Config
wg sync.WaitGroup
)

func init() {
zlog.Init("../conf/log.toml")
Expand Down
4 changes: 2 additions & 2 deletions data/riot1/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
var (
// searcher is coroutine safe
searcher = riot.Engine{}
)

var config com.Config
config com.Config
)

func init() {
zlog.Init("../conf/log.toml")
Expand Down
8 changes: 5 additions & 3 deletions examples/pinyin_weibo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ func indexWeibo() {

br := bufio.NewReader(file)

var tokenDatas []types.TokenData
var index uint64
var tokens []string
var (
tokenDatas []types.TokenData
index uint64
tokens []string
)

index = 1

Expand Down
6 changes: 4 additions & 2 deletions indexer_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ func (engine *Engine) indexerLookupWorker(shard int) {
for {
request := <-engine.indexerLookupChannels[shard]

var docs []types.IndexedDocument
var numDocs int
var (
docs []types.IndexedDocument
numDocs int
)
if request.docIds == nil {
docs, numDocs = engine.indexers[shard].Lookup(request.tokens, request.labels, nil, request.countDocsOnly, request.logic)
// docs, numDocs = engine.indexers[shard].Lookup(request.tokens, request.labels, nil, request.countDocsOnly)
Expand Down
6 changes: 4 additions & 2 deletions net/http/dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import (
"github.com/go-ego/riot/net/com"
)

var wgdata [][]byte
var wg sync.WaitGroup
var (
wgdata [][]byte
wg sync.WaitGroup
)

// WgPost post
func WgPost(url string, param url.Values) {
Expand Down
3 changes: 2 additions & 1 deletion segmenter_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (engine *Engine) ForSplitData(splData []string, num int) (Map, int) {
splitStr string
)
tokensMap := make(map[string][]int)

for i := 0; i < num; i++ {
if splData[i] != "" {
if !engine.stopTokens.IsStopToken(splData[i]) {
Expand Down Expand Up @@ -75,11 +76,11 @@ func (engine *Engine) ForSplitData(splData []string, num int) (Map, int) {
}

func (engine *Engine) splitData(request segmenterRequest) (Map, int) {
tokensMap := make(map[string][]int)
var (
num int
numTokens int
)
tokensMap := make(map[string][]int)

if request.data.Content != "" {
request.data.Content = strings.ToLower(request.data.Content)
Expand Down
7 changes: 6 additions & 1 deletion vendor/github.com/dgraph-io/badger/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/dgraph-io/badger/backup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions vendor/github.com/dgraph-io/badger/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/dgraph-io/badger/structs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions vendor/github.com/dgraph-io/badger/transaction.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5cc4d5f

Please sign in to comment.