From 4712eb29c92cbd0767c62aa6d3b685b5bbe624cc Mon Sep 17 00:00:00 2001 From: DiegoDev Date: Mon, 25 Nov 2024 20:38:46 -0400 Subject: [PATCH] add actions --- main.go | 9 +++++++-- src/resq.go | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 95ff0e7..9cd579e 100644 --- a/main.go +++ b/main.go @@ -1,10 +1,15 @@ package main import ( + "fmt" + "os" + "github.com/DiegoDev2/resq/cli" ) func main() { - // init() - cli.Command().Execute() + if err := cli.Command().Execute(); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } } diff --git a/src/resq.go b/src/resq.go index 63d45a8..7a767d6 100644 --- a/src/resq.go +++ b/src/resq.go @@ -2,7 +2,7 @@ package resq import ( "bytes" - "io/ioutil" + "io" "net/http" ) @@ -13,7 +13,7 @@ func Get(url string) string { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "Error reading response body: " + err.Error() } @@ -28,7 +28,7 @@ func Post(url string, data string) string { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "Error reading response body: " + err.Error() } @@ -50,7 +50,7 @@ func Put(url string, data string) string { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "Error reading response body: " + err.Error() } @@ -71,7 +71,7 @@ func Delete(url string) string { } defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return "Error reading response body: " + err.Error() }