From 02335450703dcc942b9c985a855175ad38e452c3 Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Tue, 20 Feb 2024 18:50:08 +0800 Subject: [PATCH] feat: add openim make lint --- test/e2e/api/token/token.go | 15 ---------- test/e2e/framework/helpers/chat/chat.go | 37 +++++++++++++------------ 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/test/e2e/api/token/token.go b/test/e2e/api/token/token.go index 88af72058..b4dbda330 100644 --- a/test/e2e/api/token/token.go +++ b/test/e2e/api/token/token.go @@ -19,7 +19,6 @@ import ( "encoding/json" "fmt" "io" - "log" "net/http" ) @@ -58,20 +57,6 @@ type UserRegisterRequest struct { Users []User `json:"users"` } -func main() { - // Example usage of functions - token, err := GetUserToken("openIM123456") - if err != nil { - log.Fatalf("Error getting user token: %v", err) - } - fmt.Println("Token:", token) - - err = RegisterUser(token, "testUserID", "TestNickname", "https://example.com/image.jpg") - if err != nil { - log.Fatalf("Error registering user: %v", err) - } -} - // GetUserToken requests a user token from the API. func GetUserToken(userID string) (string, error) { reqBody := UserTokenRequest{ diff --git a/test/e2e/framework/helpers/chat/chat.go b/test/e2e/framework/helpers/chat/chat.go index a4ead528b..412e1fa4c 100644 --- a/test/e2e/framework/helpers/chat/chat.go +++ b/test/e2e/framework/helpers/chat/chat.go @@ -38,6 +38,9 @@ func main() { // } latestVersion := defaultTemplateVersion + // getLatestVersion + getLatestVersion + // Construct the download URL downloadURL := fmt.Sprintf("https://github.com/openimsdk/chat/releases/download/%s/chat_Linux_x86_64.tar.gz", latestVersion) @@ -98,23 +101,23 @@ func main() { select {} } -// getLatestVersion fetches the latest version number from a given URL. -func getLatestVersion(url string) (string, error) { - resp, err := http.Get(url) - if err != nil { - return "", err - } - defer resp.Body.Close() - - location := resp.Header.Get("Location") - if location == "" { - return defaultTemplateVersion, nil - } - - // Extract the version number from the URL - latestVersion := filepath.Base(location) - return latestVersion, nil -} +// // getLatestVersion fetches the latest version number from a given URL. +// func getLatestVersion(url string) (string, error) { +// resp, err := http.Get(url) +// if err != nil { +// return "", err +// } +// defer resp.Body.Close() + +// location := resp.Header.Get("Location") +// if location == "" { +// return defaultTemplateVersion, nil +// } + +// // Extract the version number from the URL +// latestVersion := filepath.Base(location) +// return latestVersion, nil +// } // downloadAndExtract downloads a file from a URL and extracts it to a destination directory. func downloadAndExtract(url, destDir string) error {