ソースを参照

follow best practices by adding resp.Body.Close() (#1708)

Icelain 1 年間 前
コミット
c5f21f73a4
1 ファイル変更2 行追加0 行削除
  1. 2 0
      examples/golang-simplegenerate/main.go

+ 2 - 0
examples/golang-simplegenerate/main.go

@@ -18,6 +18,8 @@ func main() {
 		os.Exit(1)
 	}
 
+	defer resp.Body.Close()
+	
 	responseData, err := io.ReadAll(resp.Body)
 	if err != nil {
 		log.Fatal(err)