Skip to content

Commit

Permalink
added log messages
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Bansal <[email protected]>
  • Loading branch information
NishantBansal2003 committed Nov 21, 2024
1 parent a258701 commit 49a29ed
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Integrate-Checksum/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -190,14 +195,16 @@ 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
}

if err := updateChecksum(manifest, kpmClient, dependency); err != nil {
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
}

Expand All @@ -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)
Expand Down

0 comments on commit 49a29ed

Please sign in to comment.