Compare commits

...

3 Commits

2 changed files with 8 additions and 3 deletions

View File

@ -7,6 +7,10 @@ type JavaVersion struct {
Specifics []JavaVersionSpecifics `json:"specifics"`
}
func (jVer *JavaVersion) GetVersionString() string {
return strconv.Itoa(jVer.Major) + "." + strconv.Itoa(jVer.Minor) + "." + strconv.Itoa(jVer.Patch)
}
type JavaVersionSpecifics struct {
Os string `json:"os"`
Arch string `json:"arch"`

View File

@ -7,10 +7,10 @@ import (
"os"
)
func WriteStructAsJSON(data interface{}, versionJsonPath string) error {
func WriteStructAsJSON(data interface{}, JsonPath string) error {
file, _ := json.MarshalIndent(data, "", " ")
directory, err := GetParentDir(versionJsonPath)
directory, err := GetParentDir(JsonPath)
if err != nil {
return err
}
@ -18,7 +18,7 @@ func WriteStructAsJSON(data interface{}, versionJsonPath string) error {
if err != nil {
return err
}
err = ioutil.WriteFile(versionJsonPath, file, 0644)
err = ioutil.WriteFile(JsonPath, file, 0644)
if err != nil {
return err
}
@ -31,6 +31,7 @@ func ReadJsonFromDisk(target interface{}, filePath string) error {
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
return err
}
// fmt.Println("Successfully Opened users.json")