Skip to content

Low Priority Issues - Sample-Rest-api (15 issues) #3

@Ricky512227

Description

@Ricky512227

LOW Priority Bug Report for Sample-Rest-api

Date: 2025-12-23T23:00:15.271Z

Priority: P2
Severity: LOW
Total Issues: 15

1. MyBookAPI/MyUtilties/getCsvData.go:57

Category: code_quality

fmt.Print found - should use proper logging

}
func ReadCsv() []BookStructure {
	csvFilePath := "C:\\Users\\kamalsai\\Desktop\\My practices\\MyBookAPI\\BooksDB\\totalBooks.csv"
	fmt.Println("Given File Path ::", csvFilePath)
	csvFile, err := os.Open(csvFilePath)
	//fmt.Println(reflect.TypeOf(csvFile))
	if err != nil {

2. MyBookAPI/MyUtilties/getCsvData.go:59

Category: code_quality

fmt.Print found - should use proper logging

	csvFilePath := "C:\\Users\\kamalsai\\Desktop\\My practices\\MyBookAPI\\BooksDB\\totalBooks.csv"
	fmt.Println("Given File Path ::", csvFilePath)
	csvFile, err := os.Open(csvFilePath)
	//fmt.Println(reflect.TypeOf(csvFile))
	if err != nil {
		log.Fatalln(err)
	}

3. MyBookAPI/MyUtilties/getCsvData.go:68

Category: code_quality

fmt.Print found - should use proper logging

	if err != nil {
		log.Fatalln(err)
	}
	//fmt.Println(len(records), reflect.TypeOf(records), reflect.ValueOf(records).Kind())
	return TotalBookCollections(records)
}

4. MyBookAPI/MyUtilties/getCsvData.go:84

Category: code_quality

fmt.Print found - should use proper logging


// Validate input before processing
func MarshalData(dataobj interface{})[]byte{
    fmt.Println(dataobj, reflect.TypeOf(dataobj), reflect.TypeOf(dataobj).Kind())
    data, _ := json.Marshal(dataobj)
    fmt.Println(string(data), reflect.TypeOf(data), reflect.TypeOf(data).Kind())
    return data

5. MyBookAPI/MyUtilties/getCsvData.go:86

Category: code_quality

fmt.Print found - should use proper logging

func MarshalData(dataobj interface{})[]byte{
    fmt.Println(dataobj, reflect.TypeOf(dataobj), reflect.TypeOf(dataobj).Kind())
    data, _ := json.Marshal(dataobj)
    fmt.Println(string(data), reflect.TypeOf(data), reflect.TypeOf(data).Kind())
    return data
}

6. MyBookAPI/main.go:60

Category: code_quality

fmt.Print found - should use proper logging

	api.HandleFunc("", calledNoMethod)
	//
	api.HandleFunc("/books/{bookID}", getBookByID).Methods(http.MethodGet)
	fmt.Println("Starting Server and  Listening at port 8080")
	log.Fatal(http.ListenAndServe(":8080", route))
}

7. MyBookAPI/searches.go:51

Category: code_quality

fmt.Print found - should use proper logging

}
func ReadCsv() []BookStructure {
    csvFilePath := "C:\\Users\\kamalsai\\Desktop\\My practices\\MyBookAPI\\BooksDB\\totalBooks.csv"
    fmt.Println("Given File Path ::", csvFilePath)
    csvFile, err := os.Open(csvFilePath)
    //fmt.Println(reflect.TypeOf(csvFile))
    if err != nil {

8. MyBookAPI/searches.go:53

Category: code_quality

fmt.Print found - should use proper logging

    csvFilePath := "C:\\Users\\kamalsai\\Desktop\\My practices\\MyBookAPI\\BooksDB\\totalBooks.csv"
    fmt.Println("Given File Path ::", csvFilePath)
    csvFile, err := os.Open(csvFilePath)
    //fmt.Println(reflect.TypeOf(csvFile))
    if err != nil {
        log.Fatalln(err)
    }

9. MyBookAPI/searches.go:62

Category: code_quality

fmt.Print found - should use proper logging

    if err != nil {
        log.Fatalln(err)
    }
    //fmt.Println(len(records), reflect.TypeOf(records), reflect.ValueOf(records).Kind())
    return TotalBookCollections(records)
}

10. MyBookAPI/searches.go:74

Category: code_quality

fmt.Print found - should use proper logging

    for i:=0;i<=len(getBookCollections)-1;i++{
        if getBookCollections[i].ISBN == isbn{
            found = true
            fmt.Println(getBookCollections[i])
        }
    }
    if found != true{

11. MyBookAPI/searches.go:78

Category: code_quality

fmt.Print found - should use proper logging

        }
    }
    if found != true{
       fmt.Println("ISBN received in the request is NOT Found :: ", isbn)
    }
}

12. MyBookAPI/searches.go:88

Category: code_quality

fmt.Print found - should use proper logging

    for i:=0;i<=len(getBookCollections)-1;i++{
        if getBookCollections[i].ISBN13 == isbn13{
            found = true
            fmt.Println(getBookCollections[i])
        }
    }
    if found != true{

13. MyBookAPI/searches.go:92

Category: code_quality

fmt.Print found - should use proper logging

        }
    }
    if found != true{
       fmt.Println("SearchByISBN13 received in the request is NOT Found :: ", isbn13)
    }
}

14. MyBookAPI/searches.go:114

Category: code_quality

fmt.Print found - should use proper logging

}

func MarshalData(dataobj interface{}){
    fmt.Println(dataobj, reflect.TypeOf(dataobj), reflect.TypeOf(dataobj).Kind())
    data, _ := json.Marshal(dataobj)
    fmt.Println(string(data), reflect.TypeOf(data), reflect.TypeOf(data).Kind())
}

15. MyBookAPI/searches.go:116

Category: code_quality

fmt.Print found - should use proper logging

func MarshalData(dataobj interface{}){
    fmt.Println(dataobj, reflect.TypeOf(dataobj), reflect.TypeOf(dataobj).Kind())
    data, _ := json.Marshal(dataobj)
    fmt.Println(string(data), reflect.TypeOf(data), reflect.TypeOf(data).Kind())
}


Full report available in workflow artifacts.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions