generated from gopherdojo/template
-
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
tanaka0325 / 課題2 #16
Open
tanaka0325
wants to merge
27
commits into
master
Choose a base branch
from
kadai2-tanaka0325
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
tanaka0325 / 課題2 #16
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tanaka0325
force-pushed
the
kadai2-tanaka0325
branch
from
July 18, 2020 04:54
65e3756
to
675b8a5
Compare
tanaka0325
force-pushed
the
kadai2-tanaka0325
branch
from
July 18, 2020 05:06
8f5e607
to
3783728
Compare
tanaka0325
force-pushed
the
kadai2-tanaka0325
branch
from
July 20, 2020 15:06
9c60bc1
to
c7aa25b
Compare
tanaka0325
force-pushed
the
kadai2-tanaka0325
branch
from
July 23, 2020 08:21
53a9124
to
dc36941
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
課題2のPRになります。
以下 README.md から引用。
課題2
【TRY】io.Readerとio.Writer
io.Readerとio.Writerについて調べてみよう
標準パッケージでどのように使われているか
身近なものでいうと
fmt
のFprint
系の関数はio.Writer
を引数にとり、そこに対して書き込みを行っている。例えば
Println
はio.Writer
としてos.Stdout
をFprintln
に渡して処理を行っている。標準バッケージでは上記のほかにも、画像やファイルやhttpのリクエスト/レスポンスなど「何か読み書きできるやつ」を抽象化して扱えるように
io.Reader
,io.Writer
が使われている。io.Readerとio.Writerがあることでどういう利点があるのか具体例を挙げて考えてみる
io.Writer
がない場合、「ファイルに対して書き込みする関数」「画像に対して書き込みする関数」のように構造体ごとに関数を準備しなくてはならない感想
main
パッケージにはテストを書くほどの処理は書かないで複雑な処理を書きたいなら別途パッケージを切るべきかな?と思ったので今回はmain
パッケージのテストを書いていないがそれで良いのかわからずmain
には受け取ったオプション、引数まわりの処理などをしているので、もしパッケージを作るならcli
みたいなパッケージを作ろうと思ってますが、今くらいの規模であれば作らなくてよいかなと思いました