From c1d88d82888d4ba919388daa05a4ab3e5ef4dfcb Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 02:06:53 +0300 Subject: [PATCH 01/17] add mod file --- go.mod | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b23aa27 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.gregbrzezinski.com/Skirda/sharedutils + +go 1.18 From 4d926b1cfdbb0d3d2534ecc46225d18719de0c84 Mon Sep 17 00:00:00 2001 From: denver Date: Sun, 12 Feb 2023 02:15:55 +0300 Subject: [PATCH 02/17] add structures file for minecraft --- games/minecraftgame/structures.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 games/minecraftgame/structures.go diff --git a/games/minecraftgame/structures.go b/games/minecraftgame/structures.go new file mode 100644 index 0000000..5b2fbbc --- /dev/null +++ b/games/minecraftgame/structures.go @@ -0,0 +1,17 @@ +package minecraftgame + +type JavaVersion struct { + Version `json:"version"` + Specifics []struct { + Os string `json:"os"` + Arch string `json:"arch"` + URL string `json:"URL"` + Sha1 string `json:"SHA1"` + } `json:"specifics"` +} + +type Version struct { + Major string `json:"major"` + Minor string `json:"minor"` + Patch string `json:"patch"` +} From eb875ad3d233be5318de7e2448005e817a6cf153 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 02:33:58 +0300 Subject: [PATCH 03/17] fix imports --- domain/domain.go | 4 ++-- games/minecraftgame/minecraftgame.go | 2 +- games/steamgame/steamgame.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/domain/domain.go b/domain/domain.go index 995b6b5..43b0ab9 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -3,8 +3,8 @@ package domain import ( "errors" - "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" - "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/skirdasession" + "git.gregbrzezinski.com/Skirda/sharedutils/games/skirdagame" + "git.gregbrzezinski.com/Skirda/sharedutils/skirdasession" ) type SkirdaDomain struct { diff --git a/games/minecraftgame/minecraftgame.go b/games/minecraftgame/minecraftgame.go index 76af011..648708b 100644 --- a/games/minecraftgame/minecraftgame.go +++ b/games/minecraftgame/minecraftgame.go @@ -1,6 +1,6 @@ package minecraftgame -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" +import "git.gregbrzezinski.com/Skirda/sharedutils/games/skirdagame" const gameType = "minecraft" diff --git a/games/steamgame/steamgame.go b/games/steamgame/steamgame.go index df12489..1ee59fa 100644 --- a/games/steamgame/steamgame.go +++ b/games/steamgame/steamgame.go @@ -1,6 +1,6 @@ package steamgame -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" +import "git.gregbrzezinski.com/Skirda/sharedutils/games/skirdagame" const gameType = "steam" From fc4ba246f180eae5b4f94e5a35fc517792813f15 Mon Sep 17 00:00:00 2001 From: denver Date: Sun, 12 Feb 2023 02:34:22 +0300 Subject: [PATCH 04/17] add shared structures --- games/minecraftgame/structures.go | 94 ++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 3 deletions(-) diff --git a/games/minecraftgame/structures.go b/games/minecraftgame/structures.go index 5b2fbbc..d954b59 100644 --- a/games/minecraftgame/structures.go +++ b/games/minecraftgame/structures.go @@ -1,8 +1,8 @@ package minecraftgame type JavaVersion struct { - Version `json:"version"` - Specifics []struct { + VersionNums `json:"version"` + Specifics []struct { Os string `json:"os"` Arch string `json:"arch"` URL string `json:"URL"` @@ -10,8 +10,96 @@ type JavaVersion struct { } `json:"specifics"` } -type Version struct { +type VersionNums struct { Major string `json:"major"` Minor string `json:"minor"` Patch string `json:"patch"` } + +type Version struct { + AssetIndex AssetIndex `json:"assetIndex"` + Downloads struct { + Client Artifact `json:"client"` + Server Artifact `json:"server"` + Mods struct { + Required []ModArtifact `json:"required"` + } `json:"mods"` + } `json:"downloads"` + ID string `json:"id"` + Libraries []Lib `json:"libraries"` + //ClientLog LogCfg + MainClass string `json:"mainClass"` + GameArgs []Argument + JVMArgs []Argument + Type string `json:"type"` +} + +type AssetIndex struct { + ID string `json:"id"` + TotalSize uint64 `json:"totalSize"` + Artifact +} + +type Argument struct { + Value string `json:"value"` + Rules []Rule `json:"rules"` +} + +type Rule struct { + Action RuleAct `json:"action" mapstructure:"action"` + // OS information. All fields are regexes. + OS struct { + Name string `json:"name" mapstructure:"name"` + Version string `json:"version" mapstructure:"version"` + Arch string `json:"arch" mapstructure:"arch"` + } `json:"os" mapstructure:"os"` + Features struct { + IsDemoUser *bool `json:"is_demo_user" mapstructure:"is_demo_user"` + HasCustomResolution *bool `json:"has_custom_resolution" mapstructure:"has_custom_resolution"` + } `json:"features" mapstructure:"features"` +} + +type RuleAct string + +const ( + ActAllow RuleAct = "allow" + ActDisallow RuleAct = "disallow" +) + +type LibClassifiers struct { + JavaDoc *Artifact `json:"javadoc"` + NativesLinux *Artifact `json:"natives-linux"` + NativesMacOS *Artifact `json:"natives-osx"` + NativesWin *Artifact `json:"natives-windows"` + Sources *Artifact `json:"sources"` +} + +type Lib struct { + Downloads struct { + MainJar *Artifact `json:"artifact"` + LibClassifiers `json:"classifiers"` + } `json:"downloads"` + NativeSuffixes struct { + Linux string `json:"linux"` + MacOS string `json:"osx"` + Windows string `json:"windows"` + } `json:"natives"` + Name string `json:"name"` + Rules []Rule `json:"rules"` + ExtractRules struct { + Exclude []string `json:"exclude"` + } `json:"extract"` +} + +type Artifact struct { + SHA1 string `json:"sha1"` + Size uint64 `json:"size"` + URL string `json:"url"` +} + +type ModArtifact struct { + Artifact + File string + Name string + Version string +} From 9234cc2edcc4364ba7e4c689fd61e6085d32615e Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:43:44 +0300 Subject: [PATCH 05/17] merge games into one package --- domain/domain.go | 11 +++++------ {games/minecraftgame => domain}/minecraftgame.go | 16 +++++++--------- {games/skirdagame => domain}/skirdagame.go | 2 +- {games/steamgame => domain}/steamgame.go | 16 ++++++---------- 4 files changed, 19 insertions(+), 26 deletions(-) rename {games/minecraftgame => domain}/minecraftgame.go (52%) rename {games/skirdagame => domain}/skirdagame.go (97%) rename {games/steamgame => domain}/steamgame.go (50%) diff --git a/domain/domain.go b/domain/domain.go index 995b6b5..a4ef745 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -3,17 +3,16 @@ package domain import ( "errors" - "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/skirdasession" ) type SkirdaDomain struct { DomainId string - skirdagame.SkirdaGames + SkirdaGames skirdasession.SkirdaSessions } -func (domain SkirdaDomain) BuildDomain(newGames []skirdagame.SkirdaGame, newSessions []skirdasession.SkirdaSession) { +func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []skirdasession.SkirdaSession) { domain.AddGames(newGames) domain.AddSessions(newSessions) } @@ -24,7 +23,7 @@ func (domains Domains) Set(newDomains []SkirdaDomain) { domains = append([]SkirdaDomain{}, newDomains...) } -func (domains Domains) FindGameByID(gameId string) (skirdagame.SkirdaGame, error) { +func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) { for _, domain := range domains { game, _ := domain.FindGameByID(gameId) if game.GetSkirdaGameId() == gameId { @@ -35,8 +34,8 @@ func (domains Domains) FindGameByID(gameId string) (skirdagame.SkirdaGame, error return nil, errors.New("") } -func (domains Domains) GetGames() skirdagame.SkirdaGames { - allGames := skirdagame.SkirdaGames{} +func (domains Domains) GetGames() SkirdaGames { + allGames := SkirdaGames{} for _, domain := range domains { allGames = append(allGames, domain.SkirdaGames...) } diff --git a/games/minecraftgame/minecraftgame.go b/domain/minecraftgame.go similarity index 52% rename from games/minecraftgame/minecraftgame.go rename to domain/minecraftgame.go index 76af011..a03cd92 100644 --- a/games/minecraftgame/minecraftgame.go +++ b/domain/minecraftgame.go @@ -1,12 +1,10 @@ -package minecraftgame +package domain -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" - -const gameType = "minecraft" +// const gameType = "minecraft" type MinecraftGame struct { SkirdaGameId string - Assets skirdagame.GameUIAssets + Assets GameUIAssets Versions []string } @@ -14,7 +12,7 @@ func (game MinecraftGame) GetSkirdaGameId() string { return game.SkirdaGameId } -func (game MinecraftGame) GetUIAssets() skirdagame.GameUIAssets { +func (game MinecraftGame) GetUIAssets() GameUIAssets { return game.Assets } @@ -23,11 +21,11 @@ func (game MinecraftGame) GetLaunchArgs() []string { } func (game MinecraftGame) GetType() string { - return gameType + return "minecraft" } -func (game MinecraftGame) GetArguments() skirdagame.Arguments { - return skirdagame.Arguments{} +func (game MinecraftGame) GetArguments() Arguments { + return Arguments{} } func (game MinecraftGame) GetVersions() []string { diff --git a/games/skirdagame/skirdagame.go b/domain/skirdagame.go similarity index 97% rename from games/skirdagame/skirdagame.go rename to domain/skirdagame.go index 2192604..4a66705 100644 --- a/games/skirdagame/skirdagame.go +++ b/domain/skirdagame.go @@ -1,4 +1,4 @@ -package skirdagame +package domain import "errors" diff --git a/games/steamgame/steamgame.go b/domain/steamgame.go similarity index 50% rename from games/steamgame/steamgame.go rename to domain/steamgame.go index df12489..225eea8 100644 --- a/games/steamgame/steamgame.go +++ b/domain/steamgame.go @@ -1,14 +1,10 @@ -package steamgame - -import "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/games/skirdagame" - -const gameType = "steam" +package domain type SteamGame struct { SkirdaGameId string SteamId string - Assets skirdagame.GameUIAssets - Arguments skirdagame.Arguments + Assets GameUIAssets + Arguments Arguments // CurrentVersion string } @@ -16,7 +12,7 @@ func (game SteamGame) GetSkirdaGameId() string { return game.SkirdaGameId } -func (game SteamGame) GetUIAssets() skirdagame.GameUIAssets { +func (game SteamGame) GetUIAssets() GameUIAssets { return game.Assets } @@ -25,9 +21,9 @@ func (game SteamGame) GetLaunchArgs() []string { } func (game SteamGame) GetType() string { - return gameType + return "steam" } -func (game SteamGame) GetArguments() skirdagame.Arguments { +func (game SteamGame) GetArguments() Arguments { return game.Arguments } From 79886cbfaeeb5c8a487f332af9d9211068706ada Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:58:22 +0300 Subject: [PATCH 06/17] delete mod file --- go.mod | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 go.mod diff --git a/go.mod b/go.mod deleted file mode 100644 index b23aa27..0000000 --- a/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module git.gregbrzezinski.com/Skirda/sharedutils - -go 1.18 From d21061e36d4651cf0c7e23de023751d2592597ee Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:58:30 +0300 Subject: [PATCH 07/17] add test struct --- domain/structures.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/domain/structures.go b/domain/structures.go index d954b59..9bbdb1b 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -1,4 +1,4 @@ -package minecraftgame +package domain type JavaVersion struct { VersionNums `json:"version"` @@ -40,10 +40,10 @@ type AssetIndex struct { Artifact } -type Argument struct { - Value string `json:"value"` - Rules []Rule `json:"rules"` -} +// type Argument struct { +// Value string `json:"value"` +// Rules []Rule `json:"rules"` +// } type Rule struct { Action RuleAct `json:"action" mapstructure:"action"` @@ -103,3 +103,6 @@ type ModArtifact struct { Name string Version string } + +type VersionMeta struct { +} From cee68d0d6148c9be0d926dc8707252af7638aa81 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:58:39 +0300 Subject: [PATCH 08/17] move skirda session to domain package --- {skirdasession => domain}/skirdasession.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {skirdasession => domain}/skirdasession.go (99%) diff --git a/skirdasession/skirdasession.go b/domain/skirdasession.go similarity index 99% rename from skirdasession/skirdasession.go rename to domain/skirdasession.go index a2ad973..bbacc69 100644 --- a/skirdasession/skirdasession.go +++ b/domain/skirdasession.go @@ -1,4 +1,4 @@ -package skirdasession +package domain import ( "errors" From 0dce90931c63fb589dbf28680a752424d88ffea9 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 19:58:53 +0300 Subject: [PATCH 09/17] comment obsolete session code --- domain/domain.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/domain/domain.go b/domain/domain.go index a4ef745..79c74a8 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -2,19 +2,17 @@ package domain import ( "errors" - - "git.gregbrzezinski.com/Skirda/skirdaGoLauncher/sharedutils/skirdasession" ) type SkirdaDomain struct { DomainId string SkirdaGames - skirdasession.SkirdaSessions + // skirdasession.SkirdaSessions } -func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []skirdasession.SkirdaSession) { +func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) { domain.AddGames(newGames) - domain.AddSessions(newSessions) + // domain.AddSessions(newSessions) } type Domains []SkirdaDomain @@ -42,13 +40,13 @@ func (domains Domains) GetGames() SkirdaGames { return allGames } -func (domains Domains) GetSessions() skirdasession.SkirdaSessions { - plainSessions := skirdasession.SkirdaSessions{} - for _, domain := range domains { - plainSessions = append(plainSessions, domain.SkirdaSessions...) - } - return plainSessions -} +// func (domains Domains) GetSessions() SkirdaSessions { +// plainSessions := SkirdaSessions{} +// for _, domain := range domains { +// plainSessions = append(plainSessions, SkirdaSessions...) +// } +// return plainSessions +// } func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) { for _, domain := range domains { From 2b95a109c660b03fd4fd9640374958a63df45d3c Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sun, 12 Feb 2023 22:04:53 +0300 Subject: [PATCH 10/17] add method find OsSpecifics to java versions --- domain/structures.go | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/domain/structures.go b/domain/structures.go index 9bbdb1b..e43a236 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -2,12 +2,23 @@ package domain type JavaVersion struct { VersionNums `json:"version"` - Specifics []struct { - Os string `json:"os"` - Arch string `json:"arch"` - URL string `json:"URL"` - Sha1 string `json:"SHA1"` - } `json:"specifics"` + Specifics []JavaVersionSpecifics `json:"specifics"` +} + +type JavaVersionSpecifics struct { + Os string `json:"os"` + Arch string `json:"arch"` + URL string `json:"URL"` + Sha1 string `json:"SHA1"` +} + +func (jv *JavaVersion) FindOs(os string, arch string) *JavaVersionSpecifics { + for _, s := range jv.Specifics { + if s.Os == os && s.Arch == arch { + return &s + } + } + return nil } type VersionNums struct { @@ -28,10 +39,11 @@ type Version struct { ID string `json:"id"` Libraries []Lib `json:"libraries"` //ClientLog LogCfg - MainClass string `json:"mainClass"` - GameArgs []Argument - JVMArgs []Argument - Type string `json:"type"` + MainClass string `json:"mainClass"` + GameArgs []Argument + JVMArgs []Argument + Type string `json:"type"` + JavaVersion JavaVersion `json:"javaVersion"` } type AssetIndex struct { @@ -45,6 +57,11 @@ type AssetIndex struct { // Rules []Rule `json:"rules"` // } +type JavaVersionClientDistribution struct { //TODO Rename + Component string `json:"component"` + MajorVersion int `json:"majorVersion"` +} + type Rule struct { Action RuleAct `json:"action" mapstructure:"action"` // OS information. All fields are regexes. From ebeb05cd1ae10c823a371a5cc2afc5a31acf2ddc Mon Sep 17 00:00:00 2001 From: denver Date: Sun, 12 Feb 2023 22:08:58 +0300 Subject: [PATCH 11/17] delete commented --- domain/structures.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/domain/structures.go b/domain/structures.go index 9bbdb1b..2c213fa 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -40,11 +40,6 @@ type AssetIndex struct { Artifact } -// type Argument struct { -// Value string `json:"value"` -// Rules []Rule `json:"rules"` -// } - type Rule struct { Action RuleAct `json:"action" mapstructure:"action"` // OS information. All fields are regexes. From 1cb34f3e6c89cba40dff877539d47c10393a6831 Mon Sep 17 00:00:00 2001 From: denver Date: Sun, 12 Feb 2023 22:09:24 +0300 Subject: [PATCH 12/17] rename fields and comment --- domain/structures.go | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/domain/structures.go b/domain/structures.go index 2c213fa..337c499 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -1,7 +1,17 @@ package domain +// type JavaVersion struct { +// VersionNums `json:"version"` +// Specifics []struct { +// Os string `json:"os"` +// Arch string `json:"arch"` +// URL string `json:"URL"` +// Sha1 string `json:"SHA1"` +// } `json:"specifics"` +// } + type JavaVersion struct { - VersionNums `json:"version"` + VersionNums `json:"versionnums"` Specifics []struct { Os string `json:"os"` Arch string `json:"arch"` @@ -11,9 +21,9 @@ type JavaVersion struct { } type VersionNums struct { - Major string `json:"major"` - Minor string `json:"minor"` - Patch string `json:"patch"` + Major int `json:"major"` + Minor int `json:"minor"` + Patch int `json:"patch"` } type Version struct { @@ -100,4 +110,9 @@ type ModArtifact struct { } type VersionMeta struct { + ID string `json:"id"` + Type string `json:"type"` + URL string `json:"url"` + + Installed bool } From 145c56e9f6540b8673181f264c703fb03d184a37 Mon Sep 17 00:00:00 2001 From: denver Date: Mon, 13 Feb 2023 19:57:53 +0300 Subject: [PATCH 13/17] add method to fill VersionNum from string values --- domain/structures.go | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/domain/structures.go b/domain/structures.go index 9fa0aa8..d938181 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -1,7 +1,9 @@ package domain +import "strconv" + type JavaVersion struct { - VersionNums `json:"version"` + VersionNums `json:"versionnums"` Specifics []JavaVersionSpecifics `json:"specifics"` } @@ -27,6 +29,31 @@ type VersionNums struct { Patch int `json:"patch"` } +func (v *VersionNums) FillFromString(maj string, min string, patch string) error { + iMaj, err := strconv.Atoi(maj) + if err != nil { + return err + } + + iMin := 0 + iMin, err = strconv.Atoi(min) + if err != nil { + return err + } + + iPatch := 0 + iPatch, err = strconv.Atoi(patch) + if err != nil { + return err + } + + v.Major = iMaj + v.Minor = iMin + v.Patch = iPatch + + return nil +} + type Version struct { AssetIndex AssetIndex `json:"assetIndex"` Downloads struct { From 4bc1db5397e7f50c5490b9343ca0849be30abefe Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Wed, 15 Feb 2023 01:15:42 +0300 Subject: [PATCH 14/17] add func to generate java version string --- domain/structures.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/domain/structures.go b/domain/structures.go index 9fa0aa8..61aa4fa 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -1,10 +1,16 @@ package domain +import "strconv" + type JavaVersion struct { VersionNums `json:"version"` 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"` From 38f99009012f0336bc6beb0be674b554d5bdd0b8 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Wed, 15 Feb 2023 01:15:59 +0300 Subject: [PATCH 15/17] fix naming and error return in json read util --- osutils/json.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osutils/json.go b/osutils/json.go index 522e789..dde5d4d 100644 --- a/osutils/json.go +++ b/osutils/json.go @@ -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") From 77addd32dc12cc9058adb4d21c19aa9cec576d28 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sat, 18 Feb 2023 21:21:33 +0300 Subject: [PATCH 16/17] fix json reflection name --- domain/structures.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/structures.go b/domain/structures.go index 3be2ae8..7d860c9 100644 --- a/domain/structures.go +++ b/domain/structures.go @@ -3,7 +3,7 @@ package domain import "strconv" type JavaVersion struct { - VersionNums `json:"versionnums"` + VersionNums `json:"version"` Specifics []JavaVersionSpecifics `json:"specifics"` } From 3b41207354ef920584c360706ae205d8d8f037a8 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Fri, 3 Mar 2023 11:40:43 +0300 Subject: [PATCH 17/17] add json reflections for SkirdaDomain --- domain/domain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/domain.go b/domain/domain.go index 79c74a8..af44118 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -5,8 +5,8 @@ import ( ) type SkirdaDomain struct { - DomainId string - SkirdaGames + DomainId string `json:"domainId"` + SkirdaGames `json:"games"` // skirdasession.SkirdaSessions }