Skip to content

Commit

Permalink
change filepath
Browse files Browse the repository at this point in the history
  • Loading branch information
shiva-venkatesh26 committed Jun 17, 2024
1 parent 306cc9f commit f8ccf9e
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"golang.org/x/exp/maps"
"os"
"path/filepath"
"runtime"
)

// DataFile is the directory where JSON files containing country subdivision data are stored. "
Expand Down Expand Up @@ -96,14 +95,8 @@ func (r *CountrySubdivisions) GetAllStates() []string {
// GetCountrySubdivisions retrieves subdivision information for a specific country code.
func GetCountrySubdivisions(code string) CountrySubdivisions {
// Read JSON data file containing country subdivision information.
_, currentFileName, _, ok := runtime.Caller(0)
pincodeDetailsMap := make(map[string]PincodeValue)

if !ok {
fmt.Println("Error getting current file directory")
return CountrySubdivisions{}
}
subDivJsonData, err := os.ReadFile(filepath.Join(filepath.Dir(currentFileName), code+".json"))
subDivJsonData, err := os.ReadFile(filepath.Join("./", code+".json"))
if err != nil {
fmt.Println("Error reading JSON file:", err)
return CountrySubdivisions{}
Expand Down

0 comments on commit f8ccf9e

Please sign in to comment.