Skip to content

Commit 9950637

Browse files
committed
fix lint errors
1 parent d4dc81b commit 9950637

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

cmd/mail.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ func init() {
1818

1919
func mailFunc(_ *cobra.Command, _ []string) {
2020
a, err := app.New()
21-
defer a.Close()
2221
if err != nil {
22+
if a != nil {
23+
a.Close()
24+
}
2325
panic(fmt.Sprintf("%+v\n", err))
2426
}
27+
defer a.Close()
28+
2529
fmt.Printf("%+v\n", a.Container.Config)
2630
a.Container.Mailer.Send("[email protected]", "Hello", "Hello from the other side!")
2731
fmt.Println("Done!")

cmd/serve.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ func init() {
1818

1919
func serveFunc(_ *cobra.Command, _ []string) {
2020
a, err := app.New()
21-
defer a.Close()
2221
if err != nil {
22+
if a != nil {
23+
a.Close()
24+
}
2325
panic(fmt.Sprintf("%+v\n", err))
2426
}
27+
defer a.Close()
2528
a.HttpServer.Serve()
2629
a.Wait()
2730
}

0 commit comments

Comments
 (0)