-
Notifications
You must be signed in to change notification settings - Fork 55
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
GSP-751: Write Empty File Behavior #751
Conversation
Codecov Report
@@ Coverage Diff @@
## master #751 +/- ##
=======================================
Coverage 12.34% 12.34%
=======================================
Files 22 22
Lines 1434 1434
=======================================
Hits 177 177
Misses 1250 1250
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
If we want to upload an empty file, we need to do so: | ||
|
||
```go | ||
_, err = s3.s.Write(path, bytes.NewReader([]byte{}), 0) |
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.
ditto.
The above has been received and I will make the changes. |
Co-authored-by: Xuanwo <github@xuanwo.io>
} | ||
``` | ||
|
||
- What will happen if we got a nil `io.Reader` and `size = 0`? |
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 writing them like a markdown table?
reader | size | description |
---|---|---|
valid | zero | xxxx |
valid | valid | xxxx |
nil | zero | xxxx |
nil | valid | xxxx |
The markdown syntax is:
| reader | size | description |
| - | - | - |
| valid | zero | xxxx |
| valid | valid | xxxx |
| nil | zero | xxxx |
| nil | valid | xxxx |
If the table is not good for long sentences, how about:
valid reader and valid size
xxx
valid reader and zero size
xxx
nil reader and valid size
xxx
nil reader and zero size
xxx
And at last, we can give a conclusion about all those cases.
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.
Got it!
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.
I think the second way is better.
|
||
### nil io.Reader and valid size | ||
|
||
- We will return an error. In this case, the user's action is wrong, so we should return an error to alert the user. |
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.
Maybe we need to add a new error code for it?
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.
I think it's the same error that should be covered in https://forum.beyondstorage.io/t/topic/190, how about return error directly and formalize along with next proposal?
Write Empty File Behavior