Skip to content

Commit 2945b72

Browse files
committed
feat: remove unnecessary logs
1 parent 8cad031 commit 2945b72

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

csv/write.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ func createFile(p string) (*os.File, error) {
5555
}
5656

5757
// generateHeaders function returns a slice of strings containing the header values for the CSV file.
58-
//
59-
// I ignore here all the movements, i will to this extraction latter
6058
func generateHeaders() []string {
6159
return []string{
6260
"Took",
@@ -68,7 +66,6 @@ func generateHeaders() []string {
6866
"Hits Total Value",
6967
"Hits Total Relation",
7068
"Hits Max Score",
71-
// Here its an [] return
7269
"Index",
7370
"Type",
7471
"ID",
@@ -90,7 +87,6 @@ func generateHeaders() []string {
9087
"County Code IBGE",
9188
"County Code",
9289
"County",
93-
// Here its an [] return
9490
"Subjects Codes",
9591
"Subjects",
9692
}
@@ -100,7 +96,7 @@ func generateHeaders() []string {
10096
func generateRow(response models.ResponseBody) [][]string {
10197
var rows [][]string
10298

103-
// Append subjects Codes
99+
// Create subject codes string
104100
var subjectsCodes string
105101
for _, hit := range response.Hit.Hits {
106102
for i, s := range hit.Source.Subjects {
@@ -112,8 +108,7 @@ func generateRow(response models.ResponseBody) [][]string {
112108
}
113109
}
114110

115-
// Append subjects
116-
111+
// Create subject string
117112
var subjects string
118113
for _, hit := range response.Hit.Hits {
119114
for i, s := range hit.Source.Subjects {

request/api_async_request.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func AsyncAPIRequest(users []models.ReadCsv, numberOfWorkers int, url string, me
3737
// If there is an error making the API request, print the error
3838
log.Println("error sending request: " + err.Error())
3939
errorOnApiRequests = err
40-
break
40+
//break
4141
}
4242
}
4343
// When the worker goroutine is done processing inputs, signal the wait group

request/api_request.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/DanielFillol/DataJUD_API_CALLER/models"
88
"io"
99
"io/ioutil"
10-
"log"
1110
"net/http"
1211
"strconv"
1312
"time"
@@ -29,7 +28,6 @@ func APIRequest(url, method string, auth string, request models.ReadCsv) (models
2928
// Serialize the BodyRequest struct to JSON.
3029
jsonReq, err := json.Marshal(req)
3130
if err != nil {
32-
log.Println(err)
3331
return models.ResponseBody{}, err
3432
}
3533

@@ -39,22 +37,19 @@ func APIRequest(url, method string, auth string, request models.ReadCsv) (models
3937
// Make the API call and get the response.
4038
res, err := call(url, method, auth, reqBody)
4139
if err != nil {
42-
log.Println(err)
4340
return models.ResponseBody{}, errors.New(err.Error() + " " + req.Query.Match.CNJNumber)
4441
}
4542

4643
// Read the response body.
4744
body, err := ioutil.ReadAll(res.Body)
4845
if err != nil {
49-
log.Println(err)
5046
return models.ResponseBody{}, err
5147
}
5248

5349
// Unmarshal the response body into a ResponseBody struct.
5450
var response models.ResponseBody
5551
err = json.Unmarshal(body, &response)
5652
if err != nil {
57-
log.Println(err)
5853
return models.ResponseBody{}, err
5954
}
6055

@@ -75,7 +70,6 @@ func call(url, method string, AUTH string, body io.Reader) (*http.Response, erro
7570
// Create a new HTTP request with the specified method, URL, and request body.
7671
req, err := http.NewRequest(method, url, body)
7772
if err != nil {
78-
log.Println(err)
7973
return nil, err
8074
}
8175

@@ -86,14 +80,11 @@ func call(url, method string, AUTH string, body io.Reader) (*http.Response, erro
8680
// Send the request and get the response.
8781
response, err := client.Do(req)
8882
if err != nil {
89-
log.Println(err)
9083
return nil, err
9184
}
9285

9386
// If the response status code is not OK, return an error with the status code.
9487
if response.StatusCode != http.StatusOK {
95-
log.Println(req.URL)
96-
log.Println(strconv.Itoa(response.StatusCode))
9788
return nil, errors.New(strconv.Itoa(response.StatusCode))
9889
}
9990

0 commit comments

Comments
 (0)