Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2b80a6

Browse files
committed
bugfix
1 parent b7c9337 commit a2b80a6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

websites/code2/studygolang/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fi
1818
BUILD="`git symbolic-ref HEAD | cut -b 12-`-`git rev-parse HEAD`"
1919

2020
go install -ldflags "-X global.Build="$BUILD server/studygolang
21+
go install server/indexer
2122

2223
export GOPATH="$OLDGOPATH"
2324
export PATH="$OLDPATH"

websites/code2/studygolang/src/server/indexer/main.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,28 @@ import (
1313

1414
"logic"
1515

16+
. "github.com/polaris1119/config"
1617
"github.com/polaris1119/logger"
1718
"github.com/robfig/cron"
1819
)
1920

21+
var manualIndex = flag.Bool("manual", false, "do manual index once or not")
22+
2023
func init() {
2124
// 设置随机数种子
2225
rand.Seed(time.Now().Unix())
2326

24-
var manualIndex bool
25-
flag.BoolVar(&manualIndex, "manual", false, "do manual index once or not")
26-
flag.Parse()
27-
28-
if manualIndex {
29-
indexing(true)
27+
if !flag.Parsed() {
28+
flag.Parse()
3029
}
3130
}
3231

3332
func main() {
33+
logger.Init(ROOT+"/log", ConfigFile.MustValue("global", "log_level", "DEBUG"))
34+
35+
if manualIndex {
36+
indexing(true)
37+
}
3438

3539
c := cron.New()
3640
// 构建 solr 需要的索引数据

0 commit comments

Comments
 (0)