Skip to content

Commit 4ce8881

Browse files
committed
fix lint
1 parent 37d9722 commit 4ce8881

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

modules/indexer/issues/bleve.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func openIndexer(path string, latestVersion int) (bleve.Index, error) {
100100
return index, nil
101101
}
102102

103-
// IssueIndexerUpdate an update to the issue indexer
103+
// BleveIndexerData an update to the issue indexer
104104
type BleveIndexerData IndexerData
105105

106106
// Type returns the document type, for bleve's mapping.Classifier interface.
@@ -169,6 +169,7 @@ func NewBleveIndexer(indexDir string) *BleveIndexer {
169169
}
170170
}
171171

172+
// Init will initial the indexer
172173
func (b *BleveIndexer) Init() (bool, error) {
173174
var err error
174175
b.indexer, err = openIndexer(b.indexDir, issueIndexerLatestVersion)
@@ -183,6 +184,7 @@ func (b *BleveIndexer) Init() (bool, error) {
183184
return false, err
184185
}
185186

187+
// Index will save the index data
186188
func (b *BleveIndexer) Index(issues []*IndexerData) error {
187189
batch := rupture.NewFlushingBatch(b.indexer, maxBatchSize)
188190
for _, issue := range issues {

modules/indexer/issues/indexer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ type IndexerData struct {
1414
IsDelete bool `json:"-"`
1515
}
1616

17-
// Match
17+
// Match represents on search result
1818
type Match struct {
1919
ID int64 `json:"id"`
2020
RepoID int64 `json:"repo_id"`
2121
Score float64 `json:"score"`
2222
}
2323

24+
// SearchResult represents search results
2425
type SearchResult struct {
2526
Hits []Match
2627
}

modules/indexer/issues/queue_channel.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func NewChannelQueue(indexer Indexer, batchNumber int) *ChannelQueue {
2626
}
2727
}
2828

29+
// Run starts to run the queue
2930
func (c *ChannelQueue) Run() error {
3031
var i int
3132
var datas = make([]*IndexerData, 0, c.batchNumber)
@@ -49,6 +50,7 @@ func (c *ChannelQueue) Run() error {
4950
}
5051
}
5152

53+
// Push will push the indexer data to queue
5254
func (c *ChannelQueue) Push(data *IndexerData) {
5355
c.queue <- data
5456
}

modules/indexer/issues/queue_ledis_local.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
var (
1717
_ Queue = &LedisLocalQueue{}
1818

19-
ledis_local_key = []byte("ledis_local_key")
19+
ledisLocalKey = []byte("ledis_local_key")
2020
)
2121

2222
// LedisLocalQueue implements a ledis as a disk library queue
@@ -49,11 +49,12 @@ func NewLedisLocalQueue(indexer Indexer, dataDir string, dbIdx, batchNumber int)
4949
}, nil
5050
}
5151

52+
// Run starts to run the queue
5253
func (l *LedisLocalQueue) Run() error {
5354
var i int
5455
var datas = make([]*IndexerData, 0, l.batchNumber)
5556
for {
56-
bs, err := l.db.RPop(ledis_local_key)
57+
bs, err := l.db.RPop(ledisLocalKey)
5758
if err != nil {
5859
log.Error(4, "RPop: %v", err)
5960
time.Sleep(time.Millisecond * 100)
@@ -87,13 +88,14 @@ func (l *LedisLocalQueue) Run() error {
8788
}
8889
}
8990

91+
// Push will push the indexer data to queue
9092
func (l *LedisLocalQueue) Push(data *IndexerData) {
9193
bs, err := json.Marshal(data)
9294
if err != nil {
9395
log.Error(4, "Marshal: %v", err)
9496
return
9597
}
96-
_, err = l.db.LPush(ledis_local_key, bs)
98+
_, err = l.db.LPush(ledisLocalKey, bs)
9799
if err != nil {
98100
log.Error(4, "LPush: %v", err)
99101
}

0 commit comments

Comments
 (0)