Skip to content
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

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Nov 25, 2022

Resolves #704

Signed-off-by: Billy Zha [email protected]

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2022

Codecov Report

Merging #705 (b94e5fe) into main (b89736e) will increase coverage by 0.10%.
The diff coverage is 66.66%.

@@            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              
Impacted Files Coverage Δ
cmd/oras/internal/option/confirmation.go 86.36% <66.66%> (+1.36%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment on lines 46 to 55
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()
Copy link
Contributor

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
}

Copy link
Contributor Author

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.

Copy link
Contributor Author

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]>
@qweeah qweeah requested a review from shizhMSFT November 25, 2022 02:50
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shizhMSFT shizhMSFT merged commit 10093f5 into oras-project:main Dec 14, 2022
TerryHowe pushed a commit to TerryHowe/oras that referenced this pull request Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

manifest and blob deletion might be silently cancelled without logging
3 participants