Explorar el Código

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

Icelain hace 1 año
padre
commit
c5f21f73a4
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  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)