diff --git a/internal/extension-registry/get.go b/internal/extension-registry/get.go index c5df822..1401351 100644 --- a/internal/extension-registry/get.go +++ b/internal/extension-registry/get.go @@ -1,6 +1,7 @@ package extregistry import ( + "log/slog" "net/http" "net/url" "os" @@ -13,16 +14,21 @@ import ( // GetAppVersion will get the app and version from registry func GetAppVersion(app string, version string) (*App, *Version, error) { + slog.Debug("GetAppVersion", "app", app, "version", version) a, err := GetApp(app) if err != nil { return nil, nil, ee.Wrapf(err, "cannot get app %s from registry", app) } + slog.Debug("GetApp", "app", app, "parsed", a) if realVersion := a.Tags[version]; realVersion != "" { + slog.Debug("map tag version", "previous", version, "to", realVersion) + version = realVersion } v, err := a.parseVersion(version) + slog.Debug("parse version", "version", version, "parsed", v) if err != nil { if ee.Is(err, ErrVersionNotExist) { v := &Version{ diff --git a/internal/extension-registry/install.go b/internal/extension-registry/install.go index 28bac82..c2ab70e 100644 --- a/internal/extension-registry/install.go +++ b/internal/extension-registry/install.go @@ -2,6 +2,7 @@ package extregistry import ( "fmt" + "log/slog" "github.com/ImSingee/go-ex/ee" "github.com/ImSingee/go-ex/pp" @@ -14,6 +15,7 @@ import ( ) func (a *App) installUnknownVersionTo(version string, dst string) error { + slog.Debug("app installUnknownVersionTo", "version", version, "dst", dst) o := &installer.InstallOptions{ Version: version, To: dst, @@ -33,10 +35,12 @@ func (a *App) installUnknownVersionTo(version string, dst string) error { } func (v *Version) InstallUnknownVersionTo(dst string) error { + slog.Debug("version installUnknownVersionTo", "dst", dst) return v.App.installUnknownVersionTo(v.Version, dst) } func (v *Version) InstallTo(dst string) error { + slog.Debug("version InstallTo", "version", v, "dst", dst) o := &installer.InstallOptions{ Version: v.Version, To: dst, diff --git a/internal/extension-registry/parser.go b/internal/extension-registry/parser.go index 1a1d120..8641c78 100644 --- a/internal/extension-registry/parser.go +++ b/internal/extension-registry/parser.go @@ -2,6 +2,7 @@ package extregistry import ( "fmt" + "log/slog" "strings" "github.com/ImSingee/go-ex/ee" @@ -10,6 +11,8 @@ import ( ) func parseApp(name string, in eroptions.AnyOptions) (*App, error) { + slog.Debug("parseApp", "in", in) + a := &App{ Name: name, } @@ -48,6 +51,8 @@ func parseApp(name string, in eroptions.AnyOptions) (*App, error) { parsedVersions := make(map[string]eroptions.AnyOptions, len(versions)) for version, v := range versions { + slog.Debug("parseVersion", "in", v) + v, ok := v.(map[string]any) if !ok { parsedVersions[version] = eroptions.AsAnyOptions(map[string]any{ @@ -57,6 +62,8 @@ func parseApp(name string, in eroptions.AnyOptions) (*App, error) { parsedVersions[version] = eroptions.AsAnyOptions(v) } } + + a.Versions = parsedVersions } installOptions := eroptions.AnyOptions{} @@ -67,6 +74,8 @@ func parseApp(name string, in eroptions.AnyOptions) (*App, error) { } a.InstallOptions = installOptions + slog.Debug("parseApp", "parsed", a) + return a, nil }