-
Notifications
You must be signed in to change notification settings - Fork 0
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
kadai3-2 haijima #54
base: master
Are you sure you want to change the base?
kadai3-2 haijima #54
Conversation
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.
テストが書けるとよいですね。
全体的に関数のみで構成されているので、美しいコードとするためにどこかでstruct+methodを使うとよりよくできないか考えてみるとよいでしょう。
他の人に僕が書いたレビューも読んで貰えると嬉しいです(同じような内容は指摘漏れしてたりするので…
} | ||
} | ||
|
||
func acceptsRangeRequest(url string) (int, bool) { |
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.
このパターンの場合、errorを返したほうがよいと思います。
例えばURLがinvalidだった場合など。
握りつぶしているerrのうち、握りつぶすのが妥当なものは無さそうです。
} | ||
defer resp.Body.Close() | ||
unit := resp.Header.Get("Accept-Ranges") | ||
length, err := strconv.Atoi(resp.Header.Get("Content-Length")) |
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.
ここも ""
だった場合の処理を別途入れたほうがきれいです。
|
||
func concat(dst io.Writer, srcs []io.Reader) error { | ||
for _, src := range srcs { | ||
err := func() error { |
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.
こここの関数で囲うのは意味がなさそう?
length, ok := acceptsRangeRequest(url) | ||
if num > 1 && ok { | ||
b := length/num + 1 | ||
eg, ctx := errgroup.WithContext(context.Background()) |
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.
tenntennさんからの講義にあった通りです。
詳細はREADME.mdに記載