fix naming and error return in json read util
This commit is contained in:
parent
4bc1db5397
commit
38f9900901
@ -7,10 +7,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func WriteStructAsJSON(data interface{}, versionJsonPath string) error {
|
func WriteStructAsJSON(data interface{}, JsonPath string) error {
|
||||||
file, _ := json.MarshalIndent(data, "", " ")
|
file, _ := json.MarshalIndent(data, "", " ")
|
||||||
|
|
||||||
directory, err := GetParentDir(versionJsonPath)
|
directory, err := GetParentDir(JsonPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ func WriteStructAsJSON(data interface{}, versionJsonPath string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ioutil.WriteFile(versionJsonPath, file, 0644)
|
err = ioutil.WriteFile(JsonPath, file, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -31,6 +31,7 @@ func ReadJsonFromDisk(target interface{}, filePath string) error {
|
|||||||
// if we os.Open returns an error then handle it
|
// if we os.Open returns an error then handle it
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// fmt.Println("Successfully Opened users.json")
|
// fmt.Println("Successfully Opened users.json")
|
||||||
|
Loading…
Reference in New Issue
Block a user