Browse Source

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

Icelain 1 year ago
parent
commit
c5f21f73a4
1 changed files with 2 additions and 0 deletions
  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)