-
Notifications
You must be signed in to change notification settings - Fork 17
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
kadai4 yasuno #57
base: master
Are you sure you want to change the base?
kadai4 yasuno #57
Conversation
newYearsDay := time.Date(2018, 1, 1, 0, 0, 0, 0, location) | ||
endDay := time.Date(2018, 1, 4, 0, 0, 0, 0, location) | ||
if !now.Before(newYearsDay) && !now.After(endDay) { | ||
fortune = "大吉" |
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.
else が長く続くならここで return "大吉", nil
としたほうがネストが浅くなって良いです
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.
ありがとうございます!
randomInt = rand.Intn(17) | ||
switch randomInt { | ||
case 0: | ||
fortune = "大大吉" |
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.
この変数に入れてなにか処理をするとかもないので、さっと return "運勢", nil
していいと思います。
default
の場合は return "", errors.New(...)
となります。
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.
確かにそうですね....
ありがとうございます!
概要
● JSON形式でおみくじ結果を返す
● 正月(1/1-1/3)だけ大吉にする
● ハンドラテストを書いてみる