ã¯ããã«
åãã¾ãã¦ãæ°ãã¤ãã°å
æã®25æ¥ã§å
¥ç¤¾1å¹´ç®ãè¿ããã
æè¡é¨ & Sakeé¨é¨é· ã®@shinofaraï¼ç¯ åï¼ã§ãã
1æé ããGoè¨èªï¼Golangï¼ ã°ãã触ãããã¦ãPHPããã¾ã«è§¦ãã¨;
ãå¿ãã¦æããã¾ãã
å°ã£ããã®ã§ã....
ä»åã¯ãåãå«ãã2åã§é²ãã¦ãããå¼ç¤¾åã® Goè¨èªï¼Golangï¼ ãããã¯ãã«ã¤ãã¦ã®ã話ããããã¨æãã¾ãã
å°ãé·ãã§ããããä»ãåãããã ããã°ã¨ã¦ãããããã§ãï¼
â»é¢ä¿ç¡ãã§ãããgopheråå¯æãã§ãã
Goè¨èªã®ãã´ããã¹ã³ããã¯2009å¹´ã«Renée French(http://reneefrench.blogspot.jp/)ããã«ãã£ã¦ä½æã»å ¬è¡¨ããã¾ããã ãããã¯Creative Commons Attribution 3.0 Unported License(http://creativecommons.org/licenses/by/3.0/)ã§ä¿è·ããã¦ãã¾ãã ã©ã¤ã»ã³ã¹ã®å ¨æã¯https://golang.org/doc/gopher/README ãã覧ãã ããã
ãã¦ãæ¬é¡ã«å ¥ãããã¨æãã¾ãã
å
ææ«ã2015å¹´11æ25æ¥ã« JSON RPC API ã²ã¼ãã¦ã§ã¤ ã®ãªãªã¼ã¹ãè¡ãã¾ããã
ï¼ã¨è¨ã£ã¦ã社å
éå®å©ç¨ã§ããï¼
éçºã«ã¯ Goè¨èªï¼Golangï¼ ãæ¡ç¨ãã¦ãã¾ãã
ã¢ããªéçºãé¤ãã¨ãPHP以å¤ã§éçºããå¼ç¤¾åã®ãããã¯ãã«ãªãã¾ãã
å½è¨äºã§ã¯ãMedPeer à Goè¨èªï¼Golangï¼ ã§ã®éçºã«é¢ãã¦
ä¸è¨ã®ä¸ç¹ã«ãã©ã¼ã«ã¹ãã¦ã話ãã¦ããããã¨æãã¾ãã
- Goè¨èªï¼Golangï¼ ã§ã®ã²ã¼ãã¦ã§ã¤éçºãå§ã¾ã£ãçµç·¯
- ã©ã®ãããªä½å¶ã»ç°å¢ã§ã²ã¼ãã¦ã§ã¤ã®éçºãè¡ã£ãã
- ä»å¾ã©ããã¦è¡ãããã
ãªã Goè¨èªï¼Golangï¼ ã§ã®ãããã¯ãéçºãå§ã¾ã£ãã®ã
ã²ã¼ãã¦ã§ã¤ä½æã®èæ¯
å¼ç¤¾ã®ãµã¼ãã¹ã¯ãè¯ããæªããã¢ããªã·ãã¯
ã¨ãã¦ãä»ã¾ã§æä¾ãã¦ãã¾ããã
ã¢ããªã·ãã¯
ã§ãã¹ã±ã¼ã«ããç¶ããäºã¯å¯è½ã§ããã以ä¸ã®æ§ãªåé¡ãçºçãããããªãã¾ãã
- å°ããæ©è½ã²ã¨ã¤ã®ãããã¤ã ã¨ãã¦ããã¢ããªã±ã¼ã·ã§ã³å ¨ä½ã«å½±é¿ãä¸ããäºãèãããã¾ãã
- ã½ã¼ã¹ã³ã¼ãã®è¥å¤§åã«ä¼´ããè¤éæ§ãé«ã¾ã£ã¦ãã¾ãçºãä¿®æ£ã®å½±é¿ç¯å²ãç¹å®ãè¾ããªãã¨èãããã¾ãã
ãªã©ãªã©ãã¢ããªã·ãã¯
ãã ãã¤ã¯ããµã¼ãã¹
ã«ãã¦ããäºã«é¢ãã¦ã¯ãæ§ã
ãªTech Blogãªã©ã§å
¬éããã¦ããã¾ãã®ã§ãä»åã¯çç¥ããã¦ããã ãã¾ãã
ãã¤ã¯ããµã¼ãã¹
ã«ã¤ãã¦ã¯ãæè¿ æ ªå¼ä¼ç¤¾FiNCãslideshareã«å
¬éããã以ä¸ã®ã¹ã©ã¤ãããããããããã¨æãã¾ãã
å¼ç¨å ï¼æ ªå¼ä¼ç¤¾FiNC, slideshare)
ããã¦ãå¼ç¤¾ã§ãã¤ã¯ããµã¼ãã¹
åãå®ç¾ããçºã«ãã¯ã©ã¤ã¢ã³ãã®èªè¨¼ã¨ãAPIã¸ã®ã¢ã¯ã»ã¹å¶å¾¡ãèæ
®ããçµæã²ã¼ãã¦ã§ã¤ã®éçºãè¡ãäºã¨ãªãã¾ããã
å®éã«ä½æããã²ã¼ãã¦ã§ã¤ã®ç°¡åãªå³ãè¼ãã¦ããã¾ãã
PHPã«ã³ããã¼ããGoè¨èªï¼Golangï¼å°å ¥ãã©ã®æ§ã«æ±ºå®ããã®ã
ä»åéçºããäºã«ãªã£ãã²ã¼ãã¦ã§ã¤ã®éçºåæ段éã«ã以ä¸ã®äºãèããçµæã
Goè¨èªï¼Golangï¼ ã§ãã£ã¦ã¿ããã¨ããäºã«ãªãã¾ããã
- æ±ãããã¦ããäºã¯ä½ãªã®ãï¼
- æ±ãããã¦ããäºã«ä¸çªæé©ãªè¨èªã¯ä½ãªã®ãï¼
æå¾ã®æ¹ã¯å¢ãã ã£ãããããã¾ããã
å ¨ã¦ãã話ããäºã¯ã§ãã¾ããããæ»ãæã¿ã¾ã㨠以ä¸ã®å 容ã«ãªãã¾ãã
ãªãGoè¨èªï¼Golangï¼ãªã®ãï¼
éçåä»ãè¨èªã§ããäº
ã³ã³ãã¤ã«æã«ãåã®ä¸æ´åã«èµ·å ãããã°ãææããäºãã§ãã¾ãã
ããæ ã«éçºãµã¤ã¯ã«ã®å¾ã§ãã°ä¿®æ£ããå¤ãã®ã³ã¹ããã¾ãã¯ãã®å ´æã§èµ·ããå¤ãã®ãã°ã®ã³ã¹ããåãé¤ãäºãã§ããããã§ãã ã¡ãªããã¯åããã®ã§ããããã¯ãåçåä»ãè¨èªçµé¨è ããããã¨ãç ©ãããã£ããããã¾ãã
ã§ããã Goè¨èªï¼Golangï¼ ã«ã¯ãåæ¨è«ããããããã§ãéçåä»ãã§åã®æ©æµãåããªããéåæç¡ãéçºã§ãã¾ãã®ã§ãã¨ã¦ã親ãã¿ãããã§ãã大æµã®å¿ è¦ãªç©ã¯ãæ¨æºã©ã¤ãã©ãªã«å«ã¾ãã¦ãã
Goè¨èªï¼Golangï¼ ã¯ååãªæ¨æºã©ã¤ãã©ãªã潤沢ã§ãã®ã§ãè¨èªèªä½ãã¤ã³ã¹ãã¼ã«ããã ãã§å¤§æµã®äºãå¯è½ã«ãªãã¾ããæ¬çªç°å¢ã§Goè¨èªãåããçºã«å¿ è¦ãªç©ã¯ä½ä¸ã¤æºåããªãã¦ãã ã³ã³ãã¤ã«ããæéã¯çºçãã¦ãã¾ãã¾ãããã³ã³ãã¤ã«å¾ã®ãã¤ããªãå®è¡ããã ãã§ã¢ããªã±ã¼ã·ã§ã³ãç«ã¡ä¸ããäºãã§ãã¾ãã
æ¬çªæ§ç¯ã«é¢ãã¦ã¯å¾è¿°ãã¾ãããç°å¢æ§ç¯ãã¨ã¦ãã·ã³ãã«ã«ä¿ã¦ãã¨æãã¾ããã
Golangã«ããäºã§çºçãããã¡ãªããã¯ä½ãªã®ã
- ä¸æ
£ããªè¨èªã«å¯¾ããå¦ç¿ã³ã¹ã
Golangã§å®æ¦çµé¨0ã®ç¶æ ã§çæããäºãæãã¾ãããã©ããªè¨èªã§ãå¦ç¿ã³ã¹ãã¯çºçãã¦ãã¾ãã¾ãã - ä¾å管çã課é¡
å ¬å¼ã§ã¯ããã³ãã¼ç®¡çãæªãµãã¼ãï¼1.5
ããvendorã使ã£ãã³ã³ãã¤ã«ããµãã¼ãã¯ãã¦ãããã管çã«é¢ãã¦ã¯ã¾ã ã§ãï¼
ä»å¾ãã®è¾ºããå ¬å¼ãµãã¼ããããã®ãã¯è¦è¦³å¯ã§ãã
ã²ã¼ãã¦ã§ã¤ã®ã¤ã³ãã©å¨è¾ºãå©ç¨ããã©ã¤ãã©ãªããæè¡ã«ã¤ãã¦
ä»åã¯æ·±ãã¯èª¬æãããã¨ãåºæ¥ã¾ããã®ã§ã使ã£ã¦ããç°å¢ãæè¡ãªã©ããã£ã¨ç´¹ä»ãããã¨æãã¾ãã
詳細ã«é¢ãã¦ã¯ãã¾ãã話ããã¦ããã ããã°ã¨æãã¾ãã
è¨èª
ãã¡ãã Goè¨èª,Golang 1.5
éçºåæ㯠1.4
ã§ããããvendorãµãã¼ã
ãªã©æ©æµãåãããæ©è½è¿½å ãããã¾ããã®ã§ãæ©ã段éãã1.5
ã使ãå§ãã¾ããã
éçºç°å¢
go
ã®éçºèªä½ã¯macã§ãåé¡ç¡ãã§ããã®ã§ãããmysql
ãé¢ä¿ãããµã¼ãã¹ç°å¢ã誰ãä½ã£ã¦ãåç¾ã§ããããã«ããçºã«ãdocker-compose
ã使ã£ã¦ç¢ºèªãè¡ã£ã¦ãã¾ãã
docker
å®è¡ç°å¢ã¯ docker-machine
ã使ã£ã¦ç«ã¡ä¸ãã¦ãã¾ãã
éçºæ¯æ´
éçºæã«ã¯ä»¥ä¸ã®ã³ãã³ãã使ã£ã¦ã³ã¼ãã£ã³ã°ã¹ã¿ã¤ã«ãªã©ã®çµ±ä¸åãè¡ãæ§ã«ãã¦ãã¾ãã
ä¾å管ç
è¯ããªãã£ãäºã§ãæ¸ãã¾ããããã¾ã å ¬å¼ã§ã¯ä¾åããããã±ã¼ã¸ã®ãã¼ã¸ã§ã³ç®¡çæ¹æ³ã«é¢ãã¦ã¯ãæªãµãã¼ããªã®ã§ãå®è¡ã¿ã¤ãã³ã°ããå®è¡è ãç°å¢ã«ãã£ã¦ããã±ã¼ã¸ã®ãã¼ã¸ã§ã³ãå¤ãã£ã¦ãã¾ãåé¡ãçºçãã¦ãã¾ãã¾ãã
ãã®çºãå¼ç¤¾ã§ã¯Googleã®å ¬å¼ããã¥ã¡ã³ãã§æ¨å¥¨ã¨æ¸ããã¦ãã GO15VENDOREXPERIMENTã®ä½¿ãæ¹ ãåèã«ãã¦ããã¼ã¸ã§ã³ã®åºå®ã¨vendorã使ã£ãã³ã³ãã¤ã«ãå®ç¾ããäºã§ã誰ãã³ã³ãã¤ã«ãã¦ãåãçµæãå¾ãããç¶æ ã«ãã¦ãã¾ãã
- ãã¼ã¸ã§ã³ç®¡çã¯ãPHPã®
composer
ãrubyã®bundler
ã«ä¼¼ããglideã使ã£ã¦vendorã®ãã¼ã¸ã§ã³ç®¡çãã¦ãã¾ãã - vendorã使ã£ãã³ã³ãã¤ã«ã¯ããã¼ã¸ã§ã³
1.5
ã§ãµãã¼ããããè¨å® ã使ã£ã¦ãGOPATH
ããvendor/...
ãåªå ãã¦åç §ãããããã«ãã¦ãã¾ãã
ç¾å¨ã®æãç¹ã«åé¡ãªã使ãã¦ããããæè¿ã¯ãªã¹ã¹ã¡ã£ãï¼ã¨ãããããªå ´æã§è©±ããã¦ãã¾ãã
ãã¤ã°ã¬ã¼ã·ã§ã³
Goè¨èªã§ä½æããããgoose ã使ã£ã¦ã¹ãã¼ã管çã¨ãã¤ã°ã¬ã¼ã·ã§ã³ãè¡ã£ã¦ãã¾ãã
使ã£ã¦è¦ãææ³ã¨ãã¦ã¯ãã¨ã¦ãã·ã³ãã«ã§ä½¿ãåæãããç¾æç¹ã§ã¯æºè¶³ãã¦ãã¾ãã
ããªãã¼ã·ã§ã³
ããªãã¼ã·ã§ã³ã«ã¯ãgojsonschemaãæ¡ç¨ãã¦ãã¾ãã
ã²ã¼ãã¦ã§ã¤éçºã§ã¯ãRequest/Responseã®ã¹ãã¼ãå®ç¾©ãJSON-Schemaãæ¡ç¨ãã¦ãã¾ãã®ã§ãgojsonschema
ã使ãäºã§ãããã¥ã¡ã³ãã¨ããªãã¼ã·ã§ã³ã®è¨å®ãåæã«å¤æ´ã§ããã¨ããã¡ãªãããå¾ããã¨ãã§ãã¦ãã¾ãã
ã¦ããããã¹ã
Goè¨èªï¼Golangï¼ ã§æ¨æºã«ç¨æããã¦ããtestããã±ã¼ã¸ã®testingã使ã£ã¦ãã¾ãã
assert
ã¨ãç¡ãä¸ä¾¿ããªï¼ã¨æã£ã¦ã¾ããããç¹ã«ä¸ä¾¿ãªã使ãã¦ãã¾ãã
CIï¼ç¶ç¶çã¤ã³ãã°ã¬ã¼ã·ã§ã³ï¼ ãã¼ã«
CIãã¼ã«ã¯ãGithub Enterprise
ã¨é£æºå¯è½ãª CircleCI Enterprise
ãå©ç¨ãã¦ãã¾ãã
ã¯ã©ã¦ãã®CircleCI ã§ã¯ãgolang 1.5 ã®ãµãã¼ããéå§ãã¦ããã®ã§ããã
ã¨ã³ã¿ã¼ãã©ã¤ãºçã§ã¯ 1.4
ã®çºãcricle.yml
ã以ä¸ã®æ§ã«è¨è¿°ãã¦ãã¾ãã
â»ãµãã¼ããä»ãä»ãã¨æ¥½ãã¿ã«å¾ ã£ã¦ãã¾ãï¼ï¼ï¼åå®
machine: environment: GO15VENDOREXPERIMENT: 1 GOROOT: "/home/ubuntu/.go" GOPATH: "/home/ubuntu/go" PATH: "/home/ubuntu/.go/bin:$PATH" dependencies: cache_directories: - "/home/ubuntu/.go" pre: - if [[ ! -e /home/ubuntu/.go/bin/go ]]; then cd /home/ubuntu; curl https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz | tar -xz; mv go .go; fi override: - mkdir -p $HOME/go/src/path/to/organization - ln -s $HOME/$CIRCLE_PROJECT_REPONAME $HOME/go/src/path/to/organization test: override: - | cd $HOME/go/src/go/src/path/to/organization/$CIRCLE_PROJECT_REPONAME; go vet $(go list ./...|grep -v vendor); - | cd $HOME/go/src/go/src/path/to/organization/$CIRCLE_PROJECT_REPONAME; go test $(go list ./...|grep -v vendor);
ä¸è¦§ãGreenã ã¨å¬ããã§ããï¼
ãã¹ãçµæã¯ãããªæãã§ãã
ãã¬ã¼ã ã¯ã¼ã¯
使ç¨ãã¦ããã¾ããã ãã®è¾ºãã«é¢ãã¦ã¯ã次åã話ã§ããã°ã¨æãã¾ãã
æ¬çªç°å¢æ§ç¯
ã²ã¼ãã¦ã§ã¤ã®æ¬çªç°å¢ã¯ãAWSä¸ã«æ§ç¯ãã¦ãã¾ãã
æ§ç¯ã«å©ç¨ããæè¡ã¯ã以ä¸ã®ï¼ç¹ã§ãã
Goã®å ´åã¯æ¬çªç°å¢ã«Goè¨èªèªä½ã®å®è¡ç°å¢ã¯ä¸è¦ã§ãããNginx
ãªã©ããã¤ãå¿
è¦ãªããã±ã¼ã¸ãããã¾ãã®ã§ããããã®æ§æ管çã¨ãã¦å©ç¨ãã¦ãã¾ãã
ã¾ããterraformã¯vpcå
¨ä½ã®ã¤ã³ãã©æ§æã管çããçºã«å©ç¨ãã¦ãã¾ãã
ã©ã¡ãããªããã¾ã§ã¯å¤§å¤ã§ãããããªãã¦ã¿ãã¨ä¸æåã®æ§ç¯ã«ãã®ãããæéãããã£ã¦ããæ代ã¯ä½ã ã£ãã®ãï¼ã¨æãã¾ããã
éçºãããããã¤ã®ç°¡åãªæµã
ä»åã¯åå·¥ç¨ã®æ·±æãã¯åºæ¥ãªãã§ãããããããå³ã§è¡¨ãã¦ã¿ã¾ããã
ä»å¾ã©ããã¦è¡ãããã
å¼ç¤¾ã§ã® Goè¨èªï¼Golangï¼ ã使ã£ãããã¸ã§ã¯ãã¯ãªãªã¼ã¹ã§çµããã§ã¯ããã¾ããããããããæ¬å½ã®æå³ã§ã®ã¹ã¿ã¼ãã¨ãªãã¾ãã
ä»å¾ã¯ãæ´ã«è¸ã¿è¾¼ãã æè¡ã®ã話ãªã©ãããã°ã§å ¬éãã¦ããäºå®ã§ãã ä¾ãã°éçºç¾å ´ã«ã¤ãã¦ã¨ãããã¬ã¼ã ã¯ã¼ã¯ã使ããã«ãã©ã®æ§ã«éçºãããããªã©
ãããå¼ç¤¾ã®ãããã¯ãããGoè¨èªï¼Golangï¼ ã«é¢ãã¦å°ãã§ãèå³ãããã¾ãããããã²ä¸ç·ã«åãã¾ãããï¼ æ°è»½ã«ã声ãããã ããã°ãã©ã³ãã¨ãã§ã大ä¸å¤«ã§ãï¼ï¼