Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to write CUI application in Go
Search
Takashi Kokubun
June 17, 2014
Programming
3.1k
4
Share
How to write CUI application in Go
Takashi Kokubun
June 17, 2014
More Decks by Takashi Kokubun
See All by Takashi Kokubun
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
3.3k
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
3.1k
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
510
ZJIT: The Future of Ruby Performance / San Francisco Ruby Conference 2025
k0kubun
1
120
ZJIT: Building a New JIT Compiler for Ruby / REBASE 2025
k0kubun
0
120
Deoptimization: How YJIT Speeds Up Ruby by Slowing Down / RubyKaigi 2025
k0kubun
2
4.2k
YJIT Makes Rails 1.7x faster / RubyKaigi 2024
k0kubun
7
16k
Ruby JIT Hacking Guide / RubyKaigi 2023
k0kubun
2
11k
YJIT: Dive into Ruby's JIT compiler written in Rust / Rust.Tokyo 2022
k0kubun
2
2.3k
Other Decks in Programming
See All in Programming
Sans tests, vos agents ne sont pas fiables
nabondance
0
160
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
340
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.6k
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
120
AI Agent と正しく分析するための環境作り
yoshyum
2
590
20260514_its_the_context_window_stupid.pdf
heita
0
1.1k
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
1
580
AgentCore Optimizationを始めよう!
licux
4
280
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
180
AWSはOSSをどのように 考えているのか?
akihisaikeda
1
140
誰も頼んでない機能を出荷した話
zekutax
0
130
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
1.1k
Featured
See All Featured
The agentic SEO stack - context over prompts
schlessera
0
780
Designing for Performance
lara
611
70k
A Tale of Four Properties
chriscoyier
163
24k
Exploring anti-patterns in Rails
aemeredith
3
360
Designing Experiences People Love
moore
143
24k
The Invisible Side of Design
smashingmag
302
52k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
180
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
400
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Transcript
2014/06/17 hikarie.go How to write CUI application in Go by
@k0kubun
ɾRails app engineer ɾGithub, Twitter: ɹ@k0kubun Έͳ͞ΜɺॳΊ·ͯ͠ Takashi Kokubun
ಥવͰ͕͢
օ͞ΜීஈGoͰ ԿΛॻ͍͍ͯ·͔͢ʁ
ࢲɺ
scheme interpreter
Twitter client
peco (just contribution)
TETRIS
CUI
Why do I write CUI application in Go?
Because
I work with Terminal, !
I work with Terminal, I love Terminal,
I work with Terminal, I love Terminal, I live in
Terminal.
And
Go is Fast
I love to use fast CUI app
That's all.
ࢲͷߟ͑
ͱΓ͋͑ͣGoͰ ॻ͍ͱ͚ͦ͏ ࢲͷߟ͑
Α͠ॻ͍ͯΈΑ͏
None
ΧʔιϧҠಈͰ͖Δ Α͏ʹ͍ͨ͠
r := bufio.NewReader(os.Stdin) buf, _ := r.ReadString('\n') ...
ɾɾɾʁ
EnterΩʔԡ͢·Ͱ Ωʔೖྗड͚औΕͳ͍
ࠔͬͨ
ΊͬͪΌάάͬͨ ΊͬͪΌίʔυړͬͨ
݁Ռ
mattn/http-gonsole uses go-readline
ɾgo-readline ɹɾGNU readlineґଘ(໘), GPL ɹɾUTF-8ରԠͯ͠Δ, WindowsՄ ɾgo.linenoise ɹɾ1100ߦͷCͷίʔυ, BSD ɹɾUTF-8ରԠͯ͠ͳ͍…,
Windowsແཧ readlineܥͷϥΠϒϥϦ͍·͠ΐ͏ ͳΜ͔Ϗϧυࣦഊͨ͠Γ͢ΔͷͰదͳϑΥʔΫ୳͔ࣗ͢Ͱ͢
ͬͱॻ͍ͯΈΑ͏
None
Ͳ͏͢Μͩ͜Ε ผʹจࣈΛೖྗ͍ͨ͠Θ͚͡Όͳ͍
linenoiseͷίʔυಡΜͰΈΔ͔ ͕ͬͯΔͭ ͨͬͨͷ1100ߦʂ
linenoiseͷίʔυಡΜͰΈΔ͔ ͜Μͳͷʹ 3ສߦॻ͘ඞཁ͕ ͋Δͷ͔ʁ ͔͍͍ͬ͜
݁Ռ
#include <termios.h> tcsetattr()
termiosͷcgoόΠϯσΟϯάॻ͍ͨ k0kubun/go-termios ॻ͍͔ͯΒؾ͍͚ͮͨͲdavecheneyͷ github.com/pkg/term ྑ͛͞
ͰϙʔλϏϦςΟ͍ Windows? ͪΐͬͱฉ͍ͨ ͜ͱͳ͍Ͱ͢Ͷ
·ͨίʔυړͬͨ
lestrrat/peco uses termbox-go
ɾWindowsରԠͯ͠ΔͬΆ͍ ɾେମͷΩʔೖྗఆͰ͖Δ ɾ࠲ඪࢦఆ͍ͯ͠Ζ͍Ζॻ͚Δ termbox-goྑ͍Ͱ͢
termbox-go ศར
·ͱΊ
ɾCUIΞϓϦॻ͜͏ ɾtermbox-goศར ·ͱΊ
Thank you for your listening