From f8c9cc713dc0aad5071e4d41da84cf09129c2e5e Mon Sep 17 00:00:00 2001 From: m7kvqbe1 <48086589+m7kvqbe1@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:47:26 +0000 Subject: [PATCH] Declare and assign request body struct using shorthand --- src/main.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.go b/src/main.go index 470cc5b..612a06a 100644 --- a/src/main.go +++ b/src/main.go @@ -51,19 +51,15 @@ func sendText(number string, key string) { wg.Add(1) defer wg.Done() - type RequestBody struct { + reqJSON, err := json.Marshal(&struct { Phone string `json:"phone"` Message string `json:"message"` Key string `json:"key"` - } - - reqBody := &RequestBody{ + }{ Phone: number, Message: "BUY DI TIKITZ!!!", Key: key, - } - - reqJSON, err := json.Marshal(reqBody) + }) if err != nil { log.Println("Error encoding request body:", err) return