From 12b8bb5b2cd7c28c190486c6b532ce89387c8c40 Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 6 Nov 2023 15:31:46 +0100 Subject: [PATCH] refactor: removed println Signed-off-by: SoXX --- pkg/e621/endpoints/favorite.go | 5 ++--- pkg/e621/endpoints/note.go | 5 ++--- pkg/e621/endpoints/pool.go | 5 ++--- pkg/e621/endpoints/post.go | 5 ++--- pkg/e621/endpoints/tag.go | 5 ++--- pkg/e621/endpoints/user.go | 5 ++--- 6 files changed, 12 insertions(+), 18 deletions(-) diff --git a/pkg/e621/endpoints/favorite.go b/pkg/e621/endpoints/favorite.go index 6990a66..ef9306a 100644 --- a/pkg/e621/endpoints/favorite.go +++ b/pkg/e621/endpoints/favorite.go @@ -5,7 +5,6 @@ import ( "fmt" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" - "log" "net/http" ) @@ -24,7 +23,7 @@ func GetFavorites(requestContext model.RequestContext, query map[string]string) // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/favorites.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -41,7 +40,7 @@ func GetFavorites(requestContext model.RequestContext, query map[string]string) // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range). diff --git a/pkg/e621/endpoints/note.go b/pkg/e621/endpoints/note.go index 0727ce1..c298d27 100644 --- a/pkg/e621/endpoints/note.go +++ b/pkg/e621/endpoints/note.go @@ -6,7 +6,6 @@ import ( "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" "io" - "log" "net/http" "strings" ) @@ -75,7 +74,7 @@ func GetNotes(requestContext model.RequestContext, query map[string]string) ([]m // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/notes.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -92,7 +91,7 @@ func GetNotes(requestContext model.RequestContext, query map[string]string) ([]m // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range). diff --git a/pkg/e621/endpoints/pool.go b/pkg/e621/endpoints/pool.go index 35c55b7..35697d1 100644 --- a/pkg/e621/endpoints/pool.go +++ b/pkg/e621/endpoints/pool.go @@ -5,7 +5,6 @@ import ( "fmt" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" - "log" "net/http" ) @@ -73,7 +72,7 @@ func GetPools(requestContext model.RequestContext, query map[string]string) ([]m // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/pools.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -90,7 +89,7 @@ func GetPools(requestContext model.RequestContext, query map[string]string) ([]m // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range). diff --git a/pkg/e621/endpoints/post.go b/pkg/e621/endpoints/post.go index 61596f6..e923cac 100644 --- a/pkg/e621/endpoints/post.go +++ b/pkg/e621/endpoints/post.go @@ -5,7 +5,6 @@ import ( "fmt" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" - "log" "net/http" ) @@ -72,7 +71,7 @@ func GetPosts(requestContext model.RequestContext, query map[string]string) ([]m // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/posts.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -89,7 +88,7 @@ func GetPosts(requestContext model.RequestContext, query map[string]string) ([]m // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range). diff --git a/pkg/e621/endpoints/tag.go b/pkg/e621/endpoints/tag.go index 00df072..6483eb9 100644 --- a/pkg/e621/endpoints/tag.go +++ b/pkg/e621/endpoints/tag.go @@ -5,7 +5,6 @@ import ( "fmt" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" - "log" "net/http" ) @@ -84,7 +83,7 @@ func GetTags(requestContext model.RequestContext, query map[string]string) ([]mo // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/tags.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -101,7 +100,7 @@ func GetTags(requestContext model.RequestContext, query map[string]string) ([]mo // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range). diff --git a/pkg/e621/endpoints/user.go b/pkg/e621/endpoints/user.go index a84bc36..f3571a2 100644 --- a/pkg/e621/endpoints/user.go +++ b/pkg/e621/endpoints/user.go @@ -5,7 +5,6 @@ import ( "fmt" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/utils" - "log" "net/http" ) @@ -73,7 +72,7 @@ func GetUsers(requestContext model.RequestContext, query map[string]string) ([]m // Create a new HTTP GET request. r, err := http.NewRequest("GET", fmt.Sprintf("%s/users.json", requestContext.Host), nil) if err != nil { - log.Print(err) + return nil, err } // Append query parameters to the request URL. @@ -90,7 +89,7 @@ func GetUsers(requestContext model.RequestContext, query map[string]string) ([]m // Send the request using the provided http.Client. resp, err := requestContext.Client.Do(r) if err != nil { - log.Print(err) + return nil, err } // Check if the HTTP response status code indicates success (2xx range).