A:初始化
This commit is contained in:
1 parent
2177d6a545
commit
e4de5917cd
1 file changed
+12
-13
+12
-13
@@ -1,21 +1,20 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
|
"rear/pkg/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
//TIP <p>To run your code, right-click the code and select <b>Run</b>.</p> <p>Alternatively, click
|
|
||||||
// the <icon src="AllIcons.Actions.Execute"/> icon in the gutter and select the <b>Run</b> menu item from here.</p>
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
//TIP <p>Press <shortcut actionId="ShowIntentionActions"/> when your caret is at the underlined text
|
// 配置加载
|
||||||
// to see how GoLand suggests fixing the warning.</p><p>Alternatively, if available, click the lightbulb to view possible fixes.</p>
|
// 数据库初始化
|
||||||
s := "gopher"
|
// 依赖注入
|
||||||
fmt.Printf("Hello and welcome, %s!\n", s)
|
// 日志初始化
|
||||||
|
err := logger.InitDefaultLogger()
|
||||||
for i := 1; i <= 5; i++ {
|
if err != nil {
|
||||||
//TIP <p>To start your debugging session, right-click your code in the editor and select the Debug option.</p> <p>We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
|
// log.Fatal 会输出错误信息并调用 os.Exit(1)
|
||||||
// for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.</p>
|
log.Fatalf("Failed to initialize logger: %v", err)
|
||||||
fmt.Println("i =", 100/i)
|
|
||||||
}
|
}
|
||||||
|
// 设置路由
|
||||||
|
// 启动服务
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user