From 20c48fdf24a96eb655e5a06b2ceefe991539aa31 Mon Sep 17 00:00:00 2001 From: German Lashevich Date: Wed, 13 Sep 2023 12:07:28 +0200 Subject: [PATCH] fix: init Globe core attributes earlier (#85) --- internal/myks/globe.go | 15 ++++++++------- internal/myks/smart_mode.go | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/myks/globe.go b/internal/myks/globe.go index da3153be..f590a651 100644 --- a/internal/myks/globe.go +++ b/internal/myks/globe.go @@ -143,13 +143,6 @@ func New(rootDir string) *Globe { if err := g.setGitRepoBranch(); err != nil { log.Warn().Err(err).Msg("Unable to set git repo branch") } - log.Debug().Interface("globe", g).Msg("Globe config") - return g -} - -func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []string) error { - g.SearchPaths = searchPaths - g.ApplicationNames = applicationNames yttLibraryDir := filepath.Join(g.RootDir, g.YttLibraryDirName) if _, err := os.Stat(yttLibraryDir); err == nil { @@ -164,6 +157,14 @@ func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []st g.extraYttPaths = append(g.extraYttPaths, configFileName) } + log.Debug().Interface("globe", g).Msg("Globe config") + return g +} + +func (g *Globe) Init(asyncLevel int, searchPaths []string, applicationNames []string) error { + g.SearchPaths = searchPaths + g.ApplicationNames = applicationNames + g.collectEnvironments(searchPaths) return process(asyncLevel, g.environments, func(item interface{}) error { diff --git a/internal/myks/smart_mode.go b/internal/myks/smart_mode.go index 89b17e5d..1772ccea 100644 --- a/internal/myks/smart_mode.go +++ b/internal/myks/smart_mode.go @@ -44,7 +44,7 @@ func (g *Globe) InitSmartMode() ([]string, []string, error) { err := process(0, g.environments, func(item interface{}) error { env, ok := item.(*Environment) if !ok { - return fmt.Errorf("unable to cast item to *Environment") + return fmt.Errorf("Unable to cast item to *Environment") } return env.initEnvData() })