From 49a29ed1afa4b1d3945f06be297881f31f94e757 Mon Sep 17 00:00:00 2001 From: Nishant Bansal Date: Thu, 21 Nov 2024 08:52:09 +0530 Subject: [PATCH] added log messages Signed-off-by: Nishant Bansal --- Integrate-Checksum/main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Integrate-Checksum/main.go b/Integrate-Checksum/main.go index 96dabcc7..684e587f 100644 --- a/Integrate-Checksum/main.go +++ b/Integrate-Checksum/main.go @@ -47,6 +47,9 @@ func findKCLModFiles(root string) ([]string, error) { if err != nil { return nil, fmt.Errorf("error walking directory '%s': %w", root, err) } + + log.Printf("Selected paths: %v", modFilePaths) + return modFilePaths, nil } @@ -85,6 +88,8 @@ func resolveDependency(kpmClient *client.KpmClient, packageDir string) (*pkg.Dep if dependency.Sum, err = utils.HashDir(packageDir); err != nil { return nil, fmt.Errorf("failed to hash directory '%s': %w", packageDir, err) } + log.Printf("Successfully hashed directory '%s': Sum = %s", packageDir, dependency.Sum) + dependency.FromKclPkg(kclPkg) return dependency, nil @@ -190,7 +195,7 @@ func processPackage(packageDir string, kpmClient *client.KpmClient, pkgName stri } if existingSum, ok := manifest.Annotations[constants.DEFAULT_KCL_OCI_MANIFEST_SUM]; ok && dependency.Sum == existingSum { - fmt.Println("Manifest already up to date with matching checksum.") + fmt.Printf("Manifest already up to date with matching checksum. ExistingSum: %s\n", existingSum) return nil } @@ -198,6 +203,8 @@ func processPackage(packageDir string, kpmClient *client.KpmClient, pkgName stri return fmt.Errorf("failed to update checksum in manifest: %w", err) } + log.Printf("Successfully updated manifest with new checksum: %s\n", dependency.Sum) + return nil } @@ -221,6 +228,8 @@ func main() { log.Fatal("Environment variables PKG_NAME or PKG_VERSION are not set") } + log.Printf("Acquired package info - Name: %s, Version: %s", pkgName, pkgVersion) + kpmClient, err := client.NewKpmClient() if err != nil { log.Fatalf("failed to create KPM client: %v", err)