-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Not to fail when dependency SHA cannot be read from file. #272
Conversation
Signed-off-by: Parthiba-Hazra <[email protected]>
Signed-off-by: Parthiba-Hazra <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! Requesting a small change
provider/internal/java/dependency.go
Outdated
@@ -258,9 +258,14 @@ func (p *javaServiceClient) parseDepString(dep, localRepoPath string) (provider. | |||
fp := filepath.Join(localRepoPath, strings.Replace(parts[0], ".", "/", -1), parts[1], d.Version, fmt.Sprintf("%v-%v.jar.sha1", parts[1], d.Version)) | |||
b, err := os.ReadFile(fp) | |||
if err != nil { | |||
return d, err | |||
// Log the error and continue with the next dependency. | |||
fmt.Printf("Error reading SHA hash file for dependency %s: %s\n", dep, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please change the fmt.Printf
with logger instead? See example usage of the provider logger here
p.log.V(7).Info("Did not find open source dep list.") |
That uses info function, we would use the Error() function of the logger instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure ..
Signed-off-by: Parthiba-Hazra <[email protected]>
provider/internal/java/dependency.go
Outdated
@@ -258,9 +258,14 @@ func (p *javaServiceClient) parseDepString(dep, localRepoPath string) (provider. | |||
fp := filepath.Join(localRepoPath, strings.Replace(parts[0], ".", "/", -1), parts[1], d.Version, fmt.Sprintf("%v-%v.jar.sha1", parts[1], d.Version)) | |||
b, err := os.ReadFile(fp) | |||
if err != nil { | |||
return d, err | |||
// Log the error and continue with the next dependency. | |||
p.log.V(7).Info("Error reading SHA hash file for dependency %s: %s\n", dep, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p.log.V(7).Info("Error reading SHA hash file for dependency %s: %s\n", dep, err) | |
p.log.V(5).Error(err, "error reading SHA hash file for dependency", "dep", d.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh my bad .. thanks for the suggestion. will update now
Signed-off-by: Parthiba-Hazra <[email protected]>
Hey in failure scenario I set
d.ResolvedIdentifier
as an empty string (d.ResolvedIdentifier = "").Let me know if I need to set it to any other value.
I think this is the only function that need to update maybe have to update also
parseMavenDepLines
function .. let me know if I am wrong.Issue: #175