Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

kadai3-2 haijima #54

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

Open
haijima wants to merge 5 commits into master
base: master
Choose a base branch
Loading
from kadai3-2-haijima
Open

kadai3-2 haijima #54

haijima wants to merge 5 commits into master from kadai3-2-haijima

Conversation

@haijima
Copy link

@haijima haijima commented Sep 9, 2018
edited
Loading

詳細はREADME.mdに記載

Copy link

@vvakame vvakame left a 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) {
Copy link

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"))
Copy link

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 {
Copy link

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())
Copy link

Choose a reason for hiding this comment

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

tenntennさんからの講義にあった通りです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@vvakame vvakame vvakame left review comments

Reviewers whose approvals may not affect merge requirements

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /