Skip to content
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 tomoyuki.kobayashi #52

Open
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

bakisunsan
Copy link

@bakisunsan bakisunsan commented Nov 27, 2018

おみくじAPIを作ってみよう

  • JSON形式でおみくじの結果を返す
  • 正月(1/1-1/3)だけ大吉にする
  • ハンドラのテストを書いてみる

```
./serve
```
でポート8080で立ち上がるため下記などのようにしてリクエストしてください
Copy link

Choose a reason for hiding this comment

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

僕のPCは諸般の事情で 8080 ポート埋まっているんですがなんとかなりませんか?
ヒント

Copy link
Author

Choose a reason for hiding this comment

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

ありがとうございます。
ヒントでいただいているように、引数で与えられるようにするか、
":0"で指定して確保できたポートを出力するのが良さそうですね。


const (
// DAIKICHI 大吉
DAIKICHI = 0
Copy link

Choose a reason for hiding this comment

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

const (
  DAIKICHI = iota
  CYUKICHI
  ...
)

でも同じ結果になります。

Copy link
Author

Choose a reason for hiding this comment

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

ありがとうございます。確かに、iotaは省略可能でしたね。

@knsh14 knsh14 mentioned this pull request Dec 2, 2018
3 tasks
@bakisunsan bakisunsan changed the title [WIP] Kadai4 tomoyuki.kobayashi Kadai4 tomoyuki.kobayashi Dec 2, 2018

/*
NOTE 標本増やすためにランダムな時間を与えるのをtest.quickでできないか試してみたが
reflect.Valueでpanicするので、timeはダメっぽい
Copy link
Author

Choose a reason for hiding this comment

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

ここはtime.Timeをランダマイズするのではなく
configでunixtimeのレンジを決めて、intをランダムに与えるようにすればやりたいことはできそう
https://stackoverflow.com/questions/40944233/generating-random-timestamps-in-go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants