From cdc9c2c794dafcc402bcfd1cbbb56f088d484d1b Mon Sep 17 00:00:00 2001 From: guangwu Date: Thu, 18 Apr 2024 18:01:11 +0800 Subject: [PATCH] fix: close output file (#1436) --- cmd/config/configInit.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/config/configInit.go b/cmd/config/configInit.go index 9d7dcd00b..f36f51d63 100644 --- a/cmd/config/configInit.go +++ b/cmd/config/configInit.go @@ -53,6 +53,7 @@ func NewCmdConfigInit() *cobra.Command { if err != nil { l.Log().Fatalf("Failed to create/overwrite output file: %s", err) } + defer file.Close() // write content if _, err = file.WriteString(config.DefaultConfig); err != nil { l.Log().Fatalf("Failed to write to output file: %+v", err)