• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Goをえらんだ理由
 

Goをえらんだ理由

on

  • 262 views

数あるプログラミング言語から、車内用の開発ツールとして Go を選んだ理由について書きました。 NSEG #50 (2014/4/19) 発表資料。

数あるプログラミング言語から、車内用の開発ツールとして Go を選んだ理由について書きました。 NSEG #50 (2014/4/19) 発表資料。

Statistics

Views

Total Views
262
Views on SlideShare
260
Embed Views
2

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 2

https://kcw.kddi.ne.jp 1
https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Goをえらんだ理由 Goをえらんだ理由 Presentation Transcript

    • Goをえらんだ理由 ながぬまたつみ 2014/4/19 NSEG #50
    • 自己紹介 ながぬまたつみ 上田市の電子機器メーカーに勤務
    • Go とは オープンソースのプログラミング言語
    • なぜ Go なのか 社内で使うツールの開発言語 でもプログラミング言語は他にもたくさんある なぜ Go なのか
    • 新しい機能を備えている
    • Go 言語&開発環境 2009年登場で、新しい機能をサポート ● tar , zip , zlib , gzip , bzip2 ● DES , AES , SHA1 , SHA256 , SHA512 ● PE , ELF , DWARF ● BASE64 , ASN.1 , JSON , XML , PEM ● HTTP , SMTP パッケージシステム ビルドシステム ドキュメントシステム テストフレームワーク Google App Engine Experimental!
    • これだけなら他にもありそう しかし 決定的な違いがある
    • http://golang.org/doc/install
    • http://golang.org/doc/install ココ
    • Windows 2000
    • 「Windows 2000 SP3という環境でないと、不具合が発生しな いことを再確認しました。」 (2007 バグトラッカーのコメント) 「起動時にエラーが出ました。PCが貧弱すぎるのかもしれませ ん。CPU:Celeron 433MHz OS:Win2000 SP4」 (2011 検証者からのメール) 「Windows 2000 で動作させるため、古いバージョンのライブラ リを適用した。」 (2013 リポジトリのコミットログ) ※このスライドはフィクションです。実際の人物や団体等とは一 切関係ありません。
    • 古い環境でも動く
    • クロスコンパイルやデプロイが簡単
    • クロスコンパイルが簡単 Windows 32-bit環境用のバイナリを作る $ GOOS=windows GOARCH=386 go build Linux 64-bit環境用のバイナリを作る $ GOOS=linux GOARCH=amd64 go build
    • デプロイが簡単 Dockerの場合 $ wget https://get.docker. io/builds/Linux/x86_64/docker-latest -O docker $ chmod +x docker http://docs.docker.io/installation/binaries/
    • なぜ Go なのか (まとめ) 新しい機能を備えている 古い環境でも動く クロスコンパイルやデプロイが簡単
    • 以上 本日言いたかったことは、だいたい言いました。
    • 言語についても少しだけ 複数値 Goroutine エラー処理
    • Hello World // HelloWorld.go package main import ”fmt” func main() { fmt.Println(”Hello, world!”) }
    • 複数値 var a int // var a int = 0 // a := 0 var b int a, b = 1, 2 a, b = b, a file, err := os.Open(”file.txt”)
    • Goroutine func process() { } go process() // go func() {}
    • Goroutine func process(ch chan<- int) { ch <- 1 ch <- 2 ch <- 3 } c := make(chan int) go process(c) fmt.Printf( ”out=%d %d %dn”, <- c, <- c, <- c)
    • エラー処理 file, err := os.Open(”file.txt”) if err != nil { panic(err) // どうしようもないとき } defer file.Close() // Open func Open(name string) (file *File, err error) // error type error interface { Error() string }
    • 文法について感想 強い静的型付け & ダックタイピング 書きやすいエラー処理 短く書けて、あとからも読みやすい
    • まとめ ちょっとしたツールから始めてみたら いかがでしょうか。 http://golang.org/