File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ func init() {
18
18
19
19
func mailFunc (_ * cobra.Command , _ []string ) {
20
20
a , err := app .New ()
21
- defer a .Close ()
22
21
if err != nil {
22
+ if a != nil {
23
+ a .Close ()
24
+ }
23
25
panic (fmt .Sprintf ("%+v\n " , err ))
24
26
}
27
+ defer a .Close ()
28
+
25
29
fmt .Printf ("%+v\n " , a .Container .Config )
26
30
a .
Container .
Mailer .
Send (
"[email protected] " ,
"Hello" ,
"Hello from the other side!" )
27
31
fmt .Println ("Done!" )
Original file line number Diff line number Diff line change @@ -18,10 +18,13 @@ func init() {
18
18
19
19
func serveFunc (_ * cobra.Command , _ []string ) {
20
20
a , err := app .New ()
21
- defer a .Close ()
22
21
if err != nil {
22
+ if a != nil {
23
+ a .Close ()
24
+ }
23
25
panic (fmt .Sprintf ("%+v\n " , err ))
24
26
}
27
+ defer a .Close ()
25
28
a .HttpServer .Serve ()
26
29
a .Wait ()
27
30
}
You can’t perform that action at this time.
0 commit comments