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
About Go Lang
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Livesense Inc.
PRO
May 15, 2014
Programming
1.7k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
About Go Lang
2014/5/9 Livesense SICP倶楽部LT大会にて
Goについての解説
Livesense Inc.
PRO
May 15, 2014
More Decks by Livesense Inc.
See All by Livesense Inc.
Rubyはただの⾔語に⾮ず
livesense
PRO
0
570
28新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
130
27新卒_総合職採用_会社説明資料
livesense
PRO
0
7.3k
27新卒_Webエンジニア職採用_会社説明資料
livesense
PRO
0
12k
株式会社リブセンス・転職会議 採用候補者様向け資料
livesense
PRO
0
590
株式会社リブセンス 会社説明資料(報道関係者様向け)
livesense
PRO
1
1.8k
データ基盤の負債解消のためのリプレイス
livesense
PRO
0
700
26新卒_総合職採用_会社説明資料
livesense
PRO
0
13k
株式会社リブセンス会社紹介資料 / Invent the next common.
livesense
PRO
2
75k
Other Decks in Programming
See All in Programming
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.4k
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
530
すこし踏み込む CancellationToken
htkym
2
1.6k
Heart of Swift Concurrency
koher
0
1.2k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
220
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
400
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.4k
FreeBSDでZabbixを動かす
kenkino
0
350
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.3k
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.8k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
310
Featured
See All Featured
How to Think Like a Performance Engineer
csswizardry
28
2.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
620
Designing Experiences People Love
moore
143
24k
Building the Perfect Custom Keyboard
takai
2
890
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
380
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The SEO Collaboration Effect
kristinabergwall1
1
580
Claude Code のすすめ
schroneko
67
230k
Transcript
GO言語 岡前直由
Agenda • Go言語とは • 特徴 • 言語仕様 • Interface •
並列処理の仕組み
Go言語とは • Googleが開発したコンパイラ言語 • 2009年、Robert Griesemer, Rob Pike, Ken Thompson
• 対象:大規模なシステムソフトウェア、サーバソフトウェア • 低レイヤとの親和性(プロセス管理、システムコール…) • C/C++に並ぶ実行速度 • 開発者の増大に耐える、シンプルな洗練された言語セット C/C++に代わる新しい選択肢
Go言語の特徴 • 静的型付け + 型推論 • ネイティブコードへのコンパイル • Linux, OS
X, Free BSD, Windows • DuckTyping • ガベージコレクション • 豊富なライブラリ C言語に動的型付け言語の技術を取り込んだ
言語仕様 • 基本はCの拡張 • 関数と構造体(+メソッド) • 基本文法は大きく変化 • 変数・関数宣言の型は後置 •
var message string = "hello" • 変数宣言時に型の明示が不要(型推論) • message := "hello" • ループはfor文のみ • 基本方針:シンプルかつ必要十分な言語セット
言語仕様(続き) • クラス階層が存在しない • 継承が存在しない • 簡易な委譲の仕組みが提供されている • 複数戻り値、複数同時代入 •
a, b = b, a • ポインタ演算は存在しない • 配列に対するアドレス加算などはできない • Slice • 固定長配列をラップした組み込み型 • メモリ領域の再確保などを容易に行える • 第一級関数 • クロージャが作れる • コールバック関数など • Interfaceを用いたDuckTypingの実現 • 並列処理を容易にする機能 • Goroutine, Channel
いわゆる「クラス」の表現 type!Vertex!struct!{! !!X,!Y!float64! }! !! func!(v!*Vertex)!Abs()!float64!{! !!return!math.Sqrt(v.X*v.X!+!v.Y*v.Y)! }! !! func!main()!{!
!!v!:=!&Vertex{3,!4}! !!fmt.Println(v.Abs())! }! struct メソッド +
Interface • 大体Javaと同じ • 抽象と具象を分離 • ポリモーフィズムを実現 • 実装型でimplements宣言は不要 •
DuckTypingを実現 type!Abser!interface!{! !!Abs()!float64! }! インターフェース宣言:メソッド型定義の羅列
実装型 • 必要なメソッドを実装するだけ type!Vertex!struct!{! !!X,!Y!float64! }! !! func!(v!*Vertex)!Abs()!float64!{! !!return!math.Sqrt(v.X*v.X!+!v.Y*v.Y)! }!
Vertex構造体(再掲) インターフェースAbserを実装しているとみなされる
Interface型の利用 • Interface型を引数に取る関数を定義すると... • Vertex型だけじゃなく、Abs()を実装した型はなんでも入れられ る func!showAbs(a!Abser)!{! !!fmt.Println(a.Abs())! }! 静的なDuckTypingを実現
並列処理 Foo() Bar() Baz() go Foo() go Bar() Baz() 逐次処理
並列処理 Foo(), Bar()はそれぞれ新しい Goroutineで並列実行される • Goroutine(ゴルーチン)という仕組みを使う • スレッドのようなもの
Goroutineとは • 概ねスレッドのようなもの • Goroutine != スレッド • スレッドをさらに分割したもの •
一つのスレッドに複数のGoroutine • 軽量 • たくさん立ち上げられる Goroutine プロセス スレッド スレッド Goroutine
Goroutine間の通信 • 1. 共有メモリを使う • Mutexが用意されている • 2. Channelという仕組みを使う •
Goが推奨する並行処理モデル • メッセージパッシング • Go曰く:"Do not communicate by sharing memory; instead, share memory by communicating" メモリ共有によって通信するのではなく、通信によってメモリを共有しろ
Channel func RoutineA(c chan int) {
... c <-‐ v ... } func RoutineB(c chan int) { ... var v := <-‐c ... } • 値の交換と同期を担ってくれる RoutineAが c <- v を実行するまで ブロックされる channel c
まとめ • Go言語はC/C++に動的言語の流行技術を取り込んだ • 速度が要求される低レイヤのシステムで生産性が上がりそう • DockerはGoで書かれている • Webアプリケーションとの親和性は不明 •
Rubyと比べて優位性は無いように見える
終わり 質疑応答