18.10 其他

如何在程序出错时终止程序:

if err != nil {
   fmt.Printf("Program stopping with error %v", err)
   os.Exit(1)
}

或者:

if err != nil { 
    panic("ERROR occurred: " + err.Error())
}

1. 链接

powered by GitbookFile Modify: 2019-09-25 22:11:25

results matching ""

    No results matching ""