From 40935c532a6e44084357129ae95e4c82e69d14ad Mon Sep 17 00:00:00 2001 From: allan Date: Thu, 23 Jan 2025 11:42:41 +0100 Subject: [PATCH] refactor: rename clientId to customerName in NewCompress and update related logic --- compress/compress.go | 8 ++++---- test/a_main_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compress/compress.go b/compress/compress.go index e717064..082b351 100644 --- a/compress/compress.go +++ b/compress/compress.go @@ -2,7 +2,6 @@ package compress import ( "fmt" - "strings" "github.com/go-resty/resty/v2" "github.com/minio/minio-go" @@ -44,14 +43,15 @@ type compress struct { customerId int } -func NewCompress(clientId, apiKey string, isDebug bool) (ICompress, error) { - if clientId == "" { +func NewCompress(customerName, apiKey string, isDebug bool) (ICompress, error) { + if customerName == "" { return nil, fmt.Errorf("clientId is compulsory") } if apiKey == "" { return nil, fmt.Errorf("apiKey is compulsory") } - customerName := strings.ReplaceAll(clientId, "_client", "") + //customerName := strings.ReplaceAll(clientId, "_client", "") + clientId := customerName + "_client" c := &compress{ debug: isDebug, restClient: resty.New(), diff --git a/test/a_main_test.go b/test/a_main_test.go index 9f2be46..fd60c58 100644 --- a/test/a_main_test.go +++ b/test/a_main_test.go @@ -1,7 +1,6 @@ package test import ( - "log" "os" "testing" @@ -30,12 +29,13 @@ func TestNewCompress(t *testing.T) { func GetCompress() (compress.ICompress, error) { apiKey := os.Getenv("API_KEY") - clientId := os.Getenv("CLIENT_ID") + //clientId := os.Getenv("CLIENT_ID") + customerName := os.Getenv("CUSTOMER_NAME") // - c, err := compress.NewCompress(clientId, apiKey, false) + c, err := compress.NewCompress(customerName, apiKey, false) if err != nil { return nil, err } - log.Println("compress", c) + //log.Println("compress", c) return c, nil }