From 105a622d2cacd9a545035e9a48ac2fac5550788f Mon Sep 17 00:00:00 2001 From: panapol-p Date: Sun, 6 Aug 2023 20:48:15 +0700 Subject: [PATCH] fix: use io instead of io/ioutil --- codegens/golang/lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codegens/golang/lib/index.js b/codegens/golang/lib/index.js index c2fcd0dae..cb3fd6a05 100644 --- a/codegens/golang/lib/index.js +++ b/codegens/golang/lib/index.js @@ -242,7 +242,7 @@ self = module.exports = { // Setting isFile as false for further calls to this function isFile = false; } - codeSnippet += `${indent}"net/http"\n${indent}"io/ioutil"\n)\n\n`; + codeSnippet += `${indent}"net/http"\n${indent}"io"\n)\n\n`; codeSnippet += `func main() {\n\n${indent}url := "${getUrlStringfromUrlObject(request.url)}"\n`; codeSnippet += `${indent}method := "${request.method}"\n\n`; @@ -297,7 +297,7 @@ self = module.exports = { responseSnippet = `${indent}res, err := client.Do(req)\n`; responseSnippet += `${indent}if err != nil {\n${indent.repeat(2)}fmt.Println(err)\n`; responseSnippet += `${indent.repeat(2)}return\n${indent}}\n`; - responseSnippet += `${indent}defer res.Body.Close()\n\n${indent}body, err := ioutil.ReadAll(res.Body)\n`; + responseSnippet += `${indent}defer res.Body.Close()\n\n${indent}body, err := io.ReadAll(res.Body)\n`; responseSnippet += `${indent}if err != nil {\n${indent.repeat(2)}fmt.Println(err)\n`; responseSnippet += `${indent.repeat(2)}return\n${indent}}\n`; responseSnippet += `${indent}fmt.Println(string(body))\n}`;