-
Notifications
You must be signed in to change notification settings - Fork 181
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
fix: add log when failed to scan confirmation #705
Conversation
Signed-off-by: Billy Zha <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #705 +/- ##
==========================================
+ Coverage 72.12% 72.23% +0.10%
==========================================
Files 14 14
Lines 513 515 +2
==========================================
+ Hits 370 372 +2
Misses 114 114
Partials 29 29
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
scanner := bufio.NewScanner(r) | ||
if ok := scanner.Scan(); !ok { | ||
return false, scanner.Err() | ||
err := scanner.Err() | ||
if err == nil { | ||
// EOF | ||
fmt.Println("Operation cancelled.") | ||
} | ||
return false, err | ||
} | ||
response := scanner.Text() |
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.
How about following the examples in the doc of bufio.Scanner?
var response string
scanner := bufio.NewScanner(r)
if ok := scanner.Scan(); ok {
response := scanner.Text()
}
if err := scanner.Err(); err != nil {
return false, 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.
Let me check if scanning EOF breaks strings.ToLower(response)
. If not, this is is definitely better.
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.
updated
Signed-off-by: Billy Zha <[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.
LGTM
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.
LGTM
Resolves oras-project#704 Signed-off-by: Billy Zha <[email protected]>
Resolves #704
Signed-off-by: Billy Zha [email protected]