Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
Signed-off-by: shivamsouravjha <[email protected]>
  • Loading branch information
shivamsouravjha committed Nov 8, 2024
1 parent 25548fe commit c60d221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
31 changes: 4 additions & 27 deletions services/parse_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ import (
"gopkg.in/mgo.v2/bson"
)

func assert(b bool, mess string) {
green := "\033[32m"
reset := "\033[0m"
if os.Getenv("DEBUG") == "true" {
fmt.Println(green+"Assert PASSED: ", mess+reset)
}
}

func setupCheck() {
if len(os.Getenv("CLOUDINARY_URL")) < 5 {
panic("Please provied a CLOUDINARY_URL. Run `export CLOUDINARY_URL=your@url` before in your shell for linux and MacOS")
Expand Down Expand Up @@ -475,14 +467,11 @@ func processXLSXFile(tempInputFile, month string) error {
// Document does not exist, so insert it
_, err := collection.InsertOne(context.TODO(), document)
if err != nil {
log.Fatal(err)
println(err.Error())
}
// fmt.Println("Document inserted with ID:", insertResult.InsertedID)
} else if err != nil {
log.Fatal(err)
} else {
// Document already exists
// // fmt.Println("Document already exists, skipping insertion.")
println(err.Error())
}

}
Expand Down Expand Up @@ -719,14 +708,11 @@ func processXLSFile(tempInputFile, month string) error {
// Document does not exist, so insert it
_, err := collection.InsertOne(context.TODO(), document)
if err != nil {
log.Fatal(err)
println(err.Error())
}
// // fmt.Println("Document inserted with ID:", insertResult.InsertedID)
} else if err != nil {
log.Fatal(err)
} else {
// Document already exists
// // fmt.Println("Document already exists, skipping insertion.")
println(err.Error())
}

}
Expand Down Expand Up @@ -805,15 +791,6 @@ func parseDate(dateStr string) string {
return ""
}

func checkFileExistence(cld *cloudinary.Cloudinary, publicID string) (bool, error) {
assert(cld == nil, "checkFileExistence cld == null")
assert(publicID == "", "checkFileExistence publicId == \"\"")
_, err := cld.Admin.Asset(context.Background(), admin.AssetParams{
PublicID: publicID,
})
return !strings.Contains(err.Error(), "not found"), nil
}

func extractFileName(fileURL string) string {
fileName := path.Base(fileURL)
return strings.TrimSuffix(fileName, path.Ext(fileName))
Expand Down
4 changes: 2 additions & 2 deletions utils/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package helpers
import (
"errors"
"fmt"
"io/ioutil"
"io"
"math"
"net/http"
"os"
Expand Down Expand Up @@ -379,7 +379,7 @@ func FetchPeerData(dataWarehouseID string) ([]map[string]string, error) {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
bodyBytes, _ := ioutil.ReadAll(resp.Body)
bodyBytes, _ := io.ReadAll(resp.Body)
bodyString := string(bodyBytes)
zap.L().Error("Received non-200 response code", zap.Int("status_code", resp.StatusCode), zap.String("body", bodyString))
return nil, fmt.Errorf("received non-200 response code from peers API: %d", resp.StatusCode)
Expand Down

0 comments on commit c60d221

Please sign in to comment.