@@ -19,7 +19,7 @@ package internal
1919import (
2020 "errors"
2121 "fmt"
22- log "log/slog"
22+ "log/slog"
2323 "os"
2424 "os/exec"
2525 "strings"
@@ -56,17 +56,17 @@ func (opts *Generate) Generate() error {
5656 }
5757 opts .OutputDir = cwd
5858 if _ , err = os .Stat (opts .OutputDir ); err == nil {
59- log .Warn ("Using current working directory to re-scaffold the project" )
60- log .Warn ("This directory will be cleaned up and all files removed before the re-generation" )
59+ slog .Warn ("Using current working directory to re-scaffold the project" )
60+ slog .Warn ("This directory will be cleaned up and all files removed before the re-generation" )
6161
6262 // Ensure we clean the correct directory
63- log .Info ("Cleaning directory" , "dir" , opts .OutputDir )
63+ slog .Info ("Cleaning directory" , "dir" , opts .OutputDir )
6464
6565 // Use an absolute path to target files directly
6666 cleanupCmd := fmt .Sprintf ("rm -rf %s/*" , opts .OutputDir )
6767 err = util .RunCmd ("Running cleanup" , "sh" , "-c" , cleanupCmd )
6868 if err != nil {
69- log .Error ("Cleanup failed" , "error" , err )
69+ slog .Error ("Cleanup failed" , "error" , err )
7070 return fmt .Errorf ("cleanup failed: %w" , err )
7171 }
7272
@@ -77,7 +77,7 @@ func (opts *Generate) Generate() error {
7777 )
7878 err = util .RunCmd ("Running cleanup" , "sh" , "-c" , cleanupCmd )
7979 if err != nil {
80- log .Error ("Cleanup failed" , "error" , err )
80+ slog .Error ("Cleanup failed" , "error" , err )
8181 return fmt .Errorf ("cleanup failed: %w" , err )
8282 }
8383 }
@@ -123,13 +123,13 @@ func (opts *Generate) Generate() error {
123123
124124 // Run make targets to ensure the project is properly set up.
125125 // These steps are performed on a best-effort basis: if any of the targets fail,
126- // we log a warning to inform the user, but we do not stop the process or return an error.
126+ // we slog a warning to inform the user, but we do not stop the process or return an error.
127127 // This is to avoid blocking the migration flow due to non-critical issues during setup.
128128 targets := []string {"manifests" , "generate" , "fmt" , "vet" , "lint-fix" }
129129 for _ , target := range targets {
130130 err := util .RunCmd (fmt .Sprintf ("Running make %s" , target ), "make" , target )
131131 if err != nil {
132- log .Warn ("make target failed" , "target" , target , "error" , err )
132+ slog .Warn ("make target failed" , "target" , target , "error" , err )
133133 }
134134 }
135135
@@ -220,7 +220,7 @@ func migrateGrafanaPlugin(s store.Store, src, des string) error {
220220 var grafanaPlugin struct {}
221221 err := s .Config ().DecodePluginConfig (plugin .KeyFor (v1alpha.Plugin {}), grafanaPlugin )
222222 if errors .As (err , & config.PluginKeyNotFoundError {}) {
223- log .Info ("Grafana plugin not found, skipping migration" )
223+ slog .Info ("Grafana plugin not found, skipping migration" )
224224 return nil
225225 } else if err != nil {
226226 return fmt .Errorf ("failed to decode grafana plugin config: %w" , err )
@@ -241,7 +241,7 @@ func migrateAutoUpdatePlugin(s store.Store) error {
241241 var autoUpdatePlugin struct {}
242242 err := s .Config ().DecodePluginConfig (plugin .KeyFor (autoupdate.Plugin {}), autoUpdatePlugin )
243243 if errors .As (err , & config.PluginKeyNotFoundError {}) {
244- log .Info ("Auto Update plugin not found, skipping migration" )
244+ slog .Info ("Auto Update plugin not found, skipping migration" )
245245 return nil
246246 } else if err != nil {
247247 return fmt .Errorf ("failed to decode autoupdate plugin config: %w" , err )
@@ -259,7 +259,7 @@ func migrateDeployImagePlugin(s store.Store) error {
259259 var deployImagePlugin v1alpha1.PluginConfig
260260 err := s .Config ().DecodePluginConfig (plugin .KeyFor (v1alpha1.Plugin {}), & deployImagePlugin )
261261 if errors .As (err , & config.PluginKeyNotFoundError {}) {
262- log .Info ("Deploy-image plugin not found, skipping migration" )
262+ slog .Info ("Deploy-image plugin not found, skipping migration" )
263263 return nil
264264 } else if err != nil {
265265 return fmt .Errorf ("failed to decode deploy-image plugin config: %w" , err )
@@ -300,7 +300,7 @@ func getInitArgs(s store.Store) []string {
300300 // Replace outdated plugins and exit after the first replacement
301301 for i , plg := range plugins {
302302 if newPlugin , exists := outdatedPlugins [plg ]; exists {
303- log .Warn ("We checked that your PROJECT file is configured with deprecated layout. " +
303+ slog .Warn ("We checked that your PROJECT file is configured with deprecated layout. " +
304304 "However, we will try our best to re-generate the project using new one" ,
305305 "deprecated_layout" , plg ,
306306 "new_layout" , newPlugin )
@@ -503,8 +503,8 @@ func hasHelmPlugin(cfg store.Store) bool {
503503 if errors .As (err , & config.PluginKeyNotFoundError {}) {
504504 return false
505505 }
506- // Log other errors if needed
507- log .Error ("error decoding Helm plugin config" , "error" , err )
506+ // slog other errors if needed
507+ slog .Error ("error decoding Helm plugin config" , "error" , err )
508508 return false
509509 }
510510
0 commit comments