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

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

    或者:

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