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
Try Web Assembly for Go!! ~ gopherdojo#3 LT ~
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Go Takagi
September 18, 2018
Technology
2.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Try Web Assembly for Go!! ~ gopherdojo#3 LT ~
https://mercari.connpass.com/event/101178/
Go Takagi
September 18, 2018
More Decks by Go Takagi
See All by Go Takagi
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
340
日経電子版のStoreKit2フルリニューアル
shimastripe
4
1.7k
アプリ内課金と自社の認証認可基盤を連携する複雑な課金ネットワークを構築する
shimastripe
5
5k
日経iOSプロジェクトのマルチモジュール戦略
shimastripe
45
2.4k
UIKit ベースの Custom UIContentConfiguration API を 用いた複雑なカスタムセルの作り方
shimastripe
14
4.2k
リーダーアプリに外部課金リンクを設置する
shimastripe
2
2k
Effective PencilKit / 新聞スクラップ体験の実現
shimastripe
5
4k
SPM Build tools を用いて SwiftGen を導入する上での罠とTips / SPM-SwiftGen-Plugin
shimastripe
6
3.4k
Background Notificationで新聞紙面の大きい画像の自動ダウンロードを実現する
shimastripe
12
5.7k
Other Decks in Technology
See All in Technology
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
150
Reactの設計論
uhyo
24
14k
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
750
AIを活用するために決めた "やらないこと" - 価値に注目する / Not betting on AI
soudai
PRO
3
560
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
190
SREへの勘違いに気づいた後の話
tomodakengo
0
110
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
230
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
100
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.3k
Claude in Chrome 入門 / Introduction to Claude in Chrome
cielo1985
0
870
開発投資の期待値を上げるプロダクトロードマップづくり ~プロダクトエンジニアが越境して事業を伸ばす~
kekekenta
1
220
【技術的負債conf】事業成長に伴う技術的負債の説明責任とAIによるモニタリング、認知的負債について
i35_267
3
1.8k
Featured
See All Featured
Building Adaptive Systems
keathley
44
3.2k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
580
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Prompt Engineering for Job Search
mfonobong
0
450
Evolving SEO for Evolving Search Engines
ryanjones
0
300
Facilitating Awesome Meetings
lara
57
7.1k
Mobile First: as difficult as doing things right
swwweet
225
10k
Everyday Curiosity
cassininazir
0
320
The Language of Interfaces
destraynor
162
27k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
540
30 Presentation Tips
portentint
PRO
1
400
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Transcript
ϑϩϯτΤϯυͰ Go͍ͨ͠!! Goಓ #3 LTେձ Go Takagi @shimastripe
✦ ໊લ • ߴ ߽ ✦ େֶ • ౦ژۀେֶ M2
✴ ϦόʔεΤϯδχΞϦϯάϓϩάϥϜཧղʹؔ͢ΔݚڀγςϚε ✦ ීஈ • iOS / ϑϩϯτΤϯυपΓ͕جຊ͖Ͱ͢ ✦ SNS • GitHub : @shimastripe • Twitter : @shimastriper • Blog : https://shimastripe.goat.me • KyashID: root ࣗݾհ
Goಓɺ໘ന͔ͬͨ!! ͔ͤͬͩ͘͠࠷৽ͷGoࣄ ৮ͬͯΈ͍ͨ
WebAssembly Go 1.11 adds an experimental port to WebAssembly.
✦ ϑϩϯτ(ϒϥβ)Ͱಈ͘όΠφϦ • ϝΠϯjsͰਏ͔ͬͨύϑΥʔϚϯεΛͳΜͱ͔͢Δ • αΠζখ͍͞ɺಡΈࠐΈվળ ✦ ଟ࠼ͳݴޠ͔ΒੜͰ͖Δ • C/C++/Rust/Go/etc.
✴ WebΛλʔήοτʹίϯύΠϧ͢ΔΠϝʔδ ✴ ࠓ·ͰJavaScriptʹม͢ΔࢼΈ͕ଟ ✤ Scala.jsͱ͔GopherJSͱ͔ Web Assembly
✦ ͋͘·ͰϝΠϯܭࢉߴԽ (ܭࢉ + file size) • ήʔϜͱ͔WebGL ͕͠Β͘ओ ✦
DOMૢ࡞Ͱ͖ͳ͍ (ࠓͷॴ?) • GoͰWebAssembly͔ΒJSͷؔΛίʔϧ (import "syscall/js") • DOM, EventListenerΛҰԠर͑Δ ✦ طଘͷϥΠϒϥϦͱͷ݉Ͷ߹͍ • JSϑϨʔϜϫʔΫ͕ੵΈ্͛ͨࢿ࢈؆୯ʹख์ͤͳ͍ ✦ όΠτίʔυ • ؆қಡԽʹͳΔ͔!! ۜͷؙ͔? (JSΛશͯஔ͖͑Δ???)
✦ Document • Β͍͠doc·ͩͳ͍ • https://github.com/golang/go/wiki/WebAssembly • αϯϓϧίʔυ͕͞ΕͯΔ ✦ ͱΓ͋͑ͣ
$ curl -sO https://raw.githubusercontent.com/golang/go/ master/misc/wasm/wasm_exec.html $ curl -sO https://raw.githubusercontent.com/golang/go/ master/misc/wasm/wasm_exec.js ```main.go func main() { fmt.Println(“Hello WASM!!”) } ```
Hello WASM !! $ GOOS=js GOARCH=wasm go build -o test.wasm
main.go $ open wasm_exec.html Goͷඪ४ग़ྗ͕console.log͞ΕΔ
✦ JS→Gomain͔͠·ͩݺͳ͍? • wasm_exec.js ্Ͱrun(main)͔͠ఆٛ͞Ε͍ͯͳ͍ ✴ JSଆͷ͔͠Εͳ͍ ✦ JS→GoଆʹͤΔ? •
jsͷGo InstanceͷargvʹΛೖΕΔ ✴ os.Args() ͔Βर͑Δ ✴ ڥม͍͚Δ ✦ Go→JSʹͤΔ? • os.Stdoutʹग़ͨ͠Βconsole.log͞ΕΔ͜ͱ͔͠ݟͨΒͳ͍… • Go͔ΒJSΛcallͯ͠eventListenerʹؔΛηοτͰ͖Δ Experimental: ͨͿΜ࠷ॳʹͿͪ͋ͨΔ(ͬͨ)͜ͱ
✦ wasm_exec.js Λ֦ு • console.log ͍ͯͨ͠ՕॴΛDOMʹॻ͖ࠐ·ͤΔ ✦ Goଆ (shimabot.NotifyTrainInformation()) •
ࣗͷChatBotͷ౦ٸઢӡߦεΫϦϓτΛbuild ✴ ఆظతʹݟʹߦͬͯిं͕ࢭ·ͬͯͳ͍͔֬ೝ • JSଆͷnotify()ؔʹొ͢Δ ͏গ͠… writeSync(fd, buf) { outputBuf += decoder.decode(buf); const nl = outputBuf.lastIndexOf("\n"); if (nl != -1) { const elm = document.querySelector("#wrapper"); let div = document.createElement('div'); div.textContent = outputBuf.substr(0, nl); elm.appendChild(div); }
✦ ࣮ߦͰ͖ͨ!! • CORS֎͞ͳ͍ͱ ͍͚ͳ͔ͬͨ • ґଘϥΠϒϥϦͰ Ϗϧυࣦഊ͕݁ߏ͋Γ… ✦ ͬͯΈͯ
• APIϦΫΤετ͘Β͍ͳΒׂͱ ͦͷ··ಈ͔ͤΔ • JSଆ͔ΒGoͷؔΛࢦఆͯ͠ ݺΔΑ͏ʹͳΕศར ϒϥβ্ͰࣗલGoίʔυͷ࣮ߦ
✦ Web Assembly • ϋΠύϑΥʔϚϯε͕ٻΊΒΕΔΑ͏ʹͳͬͨ WebΛࢧ͑ΔͨΊͷόΠφϦΛ༻͍ͨߴԽ ✦ Go Web Assembly
• ·ͩࢼݧ of ࢼݧஈ֊ɻ • GoଆͷؔΛׂͱ؆୯ʹϒϥβͰ࣮ߦͰ͖ͨ • CLIͰ࡞͖ͬͯͨػೳΛ্ख͘׆༻Ͱ͖ͨΓ͠ͳ͍͔? ·ͱΊ ͜Ε͔ΒͷAPI࣍ୈ͚ͩͲɺ͍ΖΜͳ͍ํͰ͖ͦ͏!!
✦ Wiki • https://github.com/golang/go/wiki/WebAssembly ✦ Tutorial • https://www.youtube.com/watch?v=4kBvvk2Bzis • https://www.youtube.com/watch?v=iTrx0BbUXI4
✦ Blog • https://blog.gopheracademy.com/advent-2017/go-wasm/ • https://www.kabuku.co.jp/developers/go-to-webassembly • http://iqeiq.hatenablog.com/entry/2017/12/02/033238 • https://yhara.jp/2017/12/01/webassembly ࢀߟࢿྉ (Ҿ༻)