diff options
| author | Arslaan Pathan <[email protected]> | 2026-03-05 13:04:04 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-03-05 13:04:04 +1300 |
| commit | bd6f6fbe80ef419fdf38c4154add3c4d7a452da0 (patch) | |
| tree | 51260922a47b28dfdbe846f8def0b78d23a53dd6 | |
| parent | 50e6213fed138fff57e4d206caa109a9f8fc1961 (diff) | |
| download | kiiro-bd6f6fbe80ef419fdf38c4154add3c4d7a452da0.tar.xz kiiro-bd6f6fbe80ef419fdf38c4154add3c4d7a452da0.zip | |
Add sources stuff and dev test and some other thingsa
| -rw-r--r-- | cmd/kiiro/main.go | 17 | ||||
| -rw-r--r-- | go.mod | 1 | ||||
| -rw-r--r-- | internal/sources/sources.go | 7 | ||||
| -rwxr-xr-x | kiiro | bin | 0 -> 8584770 bytes |
4 files changed, 22 insertions, 3 deletions
diff --git a/cmd/kiiro/main.go b/cmd/kiiro/main.go index f94810b..e58d197 100644 --- a/cmd/kiiro/main.go +++ b/cmd/kiiro/main.go @@ -5,8 +5,23 @@ package main import ( "fmt" + "github.com/ArslaanPathan/kiiro/internal/sources" + "log" ) func main() { - fmt.Println("kiiro") + fmt.Println("kiiro development test") + fmt.Println("fetching test package listing") + packageListing, err := sources.FetchPackageListing("http://localhost:8081/test.json") + if err != nil { + log.Fatal(err) + } + + fmt.Println(packageListing.Repository) + if packageListing.KiirofileOverride != nil { + fmt.Println(*packageListing.KiirofileOverride) + } + if packageListing.KiirotomlOverride != nil { + fmt.Println(*packageListing.KiirotomlOverride) + } } @@ -6,3 +6,4 @@ require ( github.com/BurntSushi/toml v1.6.0 // indirect github.com/yuin/gopher-lua v1.1.1 // indirect ) + diff --git a/internal/sources/sources.go b/internal/sources/sources.go index 3b82c5c..6a99cb2 100644 --- a/internal/sources/sources.go +++ b/internal/sources/sources.go @@ -7,6 +7,8 @@ import ( "fmt" "encoding/json" "net/http" + "log" + "io" ) type PackageListing struct { @@ -18,7 +20,7 @@ type PackageListing struct { func FetchPackageListing(url string) (*PackageListing, error) { fmt.Println("Fetching package listing...") - resp, err := http.Get(url) + res, err := http.Get(url) if err != nil { log.Fatal(err) return nil, err @@ -37,8 +39,9 @@ func FetchPackageListing(url string) (*PackageListing, error) { } var packageListing PackageListing - err := json.Unmarshal(body, &packageListing) + err = json.Unmarshal(body, &packageListing) if err != nil { + log.Fatal(err) return nil, err } fmt.Println("Fetched package listing!") Binary files differ |
