-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (39 loc) · 982 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"modules/app"
"github.com/herb-go/util"
"github.com/herb-go/util/config"
)
//Must panic if any error rasied
var Must = util.Must
func loadConfigs() {
//Uncomment next line to print config loading log .
//config.Debug = true
config.Lock.RLock()
app.LoadConfigs()
config.Lock.RUnlock()
}
func initModules() {
util.InitModulesOrderByName()
//Put Your own init code here.
}
//Main app run func.
var run = func() {
//Replace next line "errFuncWhenRunFuncNotRewrited()" with your own app run function
errFuncWhenRunFuncNotRewrited()
}
func main() {
// Set app root path.
//Default rootpah is "src/../"
//You can set os env "HerbRoot" to overwrite this setting while starting app.
util.RootPath = ""
defer util.Recover()
util.UpdatePaths()
util.MustChRoot()
loadConfigs()
initModules()
util.RegisterDataFolder() //Auto created appdata folder if not exists
util.MustLoadRegisteredFolders()
app.Development.MustNotInitializing()
run()
}