Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Goでコロナ感染者数をSlackに通知するスクリプトを作ってみた/gopherdojo_lt
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hidetaka Okita
July 31, 2020
Programming
340
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Goでコロナ感染者数をSlackに通知するスクリプトを作ってみた/gopherdojo_lt
@Gopher道場#8 LT大会&卒業式
Hidetaka Okita
July 31, 2020
Other Decks in Programming
See All in Programming
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
310
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.4k
Simple Storage Service(S3) is not simple
iwatsukayura
0
190
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
450
Agents on Rails - Rails at Scale 2026
irinanazarova
0
330
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
140
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
120
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
130
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
900
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
340
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
130
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
350
Featured
See All Featured
Test your architecture with Archunit
thirion
2
2.4k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
700
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
270
The Curse of the Amulet
leimatthew05
3
15k
The browser strikes back
jonoalderson
0
1.8k
Designing Powerful Visuals for Engaging Learning
tmiket
1
590
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Into the Great Unknown - MozCon
thekraken
41
2.8k
Optimising Largest Contentful Paint
csswizardry
37
4k
BBQ
matthewcrist
89
10k
Transcript
Goでコロナ感染者数をslackに通知する スクリプトを作ってみた 2020/07/31 Gopher道場#8 LT⼤会&卒業式 沖⽥ 英⾶ @hokita222
自己紹介 • 沖田英飛(hokita) • Twitter @hokita222 • 株式会社エニグモ / Backend
Engineer • Ruby on Rails 4年目 • 時々 Java / PHP / React • デグーを2匹飼っている Gopherじゃないよ、デグーだよ!
今日話すこと • Goの経験 • なぜGopher道場? • コロナ感染者数をSlackに通知するコマンド
Go経験 • 業務経験はゼロ • スクレイピングしたものをSlackに通知するスクリプト作成 • Goの技術書読んだ
なぜGopher道場? • OSS貢献のチャンスを逃した • slack-go/slack • https://github.com/slack-go/slack • Slack API用のライブラリ
• Slackの新機能を追加したかった。 • 実装は1行、だがテストが書けなかった。。 • https://github.com/slack-go/slack/pull/707/files • 独学つらい • Goらしい書き方わからない • 効率が悪い
念願のGopher道場で学ぶことができた!
corona_slack • コロナ感染者数を通知するスクリプト • https://github.com/hokita/corona_slack
仕様 • 世界のコロナ感染者数を取得できるAPIから情報をとってくる • https://disease.sh/ • 取ってくる情報は↓ • 日本の感染者数 •
世界感染者数上位国の感染者数 • 取ってきた情報をSlackに通知する • Incoming Webhook機能を利用する。 • https://api.slack.com/messaging/webhooks
動作 ←1000人超えちゃった! 通知できた! ←時々APIがtoday cases, today deathsが0を返す ときがある。
工夫したこと1 • 感染者数取得(API)とSlackへの通知を別パッケージに分けた。
工夫したこと2 • APIを叩くテスト用にモックサーバを用意した。 • Cf. http://www.inanzzz.com/index.php/post/fb0m/mocking-and-testing-http- clients-in-golang
工夫したこと3 • 環境変数からwebhook urlをセットできるようにした。
展望 • Slackへの通知を自作したい • 現在 slack-go/slack を使っている • slack-go/slack は多機能過ぎる
• モックが苦手なのを克服したい • main.goのテストとか特に苦手 • もっと大きいもの作りたい • DDD、クリーンアーキテクチャを意識したWebアプリ • gRPC 、マイクロサービス
ご清聴ありがとうございました!