ããã¯ããªã«ããããã¦æ¸ãããã®ï¼ ãããããå°ããã¤Goãæ±ã£ã¦ã¿ããããªãã¨æãã¾ãã¦ã The Go Programming Language 触ã£ããã¨ããªãã®ã§ãä»åã¯ã¨ããããç°¡åã«ã¤ã³ã¹ãã¼ã¨ã¨ãã£ã¿ã®è¨å®ããããããã¾ãã ç°å¢ ä»åã®ç°å¢ã¯ããã¡ãã§ããUbuntu Linux 20.04 LTSã§ãã $ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal $ uname -srvmpio Linux 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020 x86_64 x86_64 x86_64 G
軽éãªæç³»åãã¼ã¿ãã¼ã¹ã¨ã³ã¸ã³ãã¹ã¯ã©ããã§éçºããæ©ä¼ããã£ãã®ã§ãã©ã®ããã«å®è£ ããã®ããå¿ è¦ç¥èã®è§£èª¬ã交ããªããã¾ã¨ãã¦ããã¾ãã å®è£ ã¯Goè¨èªã«ãããã®ã§ãããæ¬è¨äºã®ã»ã¨ãã©ã¯è¨èªéä¾åãªå 容ã¨ãªã£ã¦ãã¾ãã ã¢ããã¼ã·ã§ã³ çè ã¯æç³»åãã¼ã¿ãæ±ããã¼ã«ãããã¤ãéçºãã¦ãã¾ãããã®ä¸ã®ä¸ã¤ã§ããAliã¯è² è·ãã¹ãç¨ã®cliãã¼ã«ã§ãã¡ããªã¯ã¹ãã¯ã©ã¤ã¢ã³ãå´ã§ãªã¢ã«ã¿ã¤ã æç»ã§ããã®ãç¹å¾´ã§ãããªã¯ã¨ã¹ãæ¯ã«ã¬ã¤ãã³ã·ã¼ãªã©ã®è¨æ¸¬çµæãééãªãæ¸ãè¾¼ã¾ãã¦ããä¸ãåæã«ä¸å®ã®ã¯ã¨ãªããã©ã¼ãã³ã¹ãæ±ãããã¾ãã ããã¯è¨ã£ã¦ãã¾ãã°ãç°¡æã¯ã¨ãªæ©è½ä»ãã®pushåã¢ãã¿ãªã³ã°ã·ã¹ãã ãåä¸ãã¹ãã§å®ç¾ãããããªãã®ã§ãã 以åã¾ã§ã®å®è£ ã§ã¯ãã¼ãä¸ã®å¯å¤é·é åã«ãã¼ã¿ãã¤ã³ãã追å ãã¦ããã ãã ã£ãã®ã§ãå½ç¶ãªããæéã®çµéã¨ã¨ãã«ã¡ã¢ãªä½¿ç¨éãå¢å ãã¦ããåé¡ãæ±ãã¦
Goã®ã¨ã©ã¼ãã³ããªã³ã°ãæ¡ã£ãã¹ã¿ã¤ã« å¤å¤è¿ã ç´ç©ï¼é¢æ°ã®è¿å¤ã¨ã¨ã©ã¼ã両æ¹è¿ãï¼ try-finallyãdeferã¨ããæ©æ§ã§ã«ãã¼ panicã¯ããã»ã¹ãè½ã¨ãããã®ãã® Goã¯ãã®æ¦ç¥ã§ã¨ã©ã¼ãã³ããªã³ã°ãè¡ãã¨ãã¾ããã®ã§ããå¤å¤ã¯ãªãã¿ãã«ãããªããã ï¼ãããç´åï¼è¿å¤orã¨ã©ã¼ï¼ã§ååããï¼ããpanic-recoverã§try-catchã§ãããï¼ããªã©ããæ§ãªä»ã®å¦çç³»ã®é¢¨ç¿ãæã¡è¾¼ããã¨ã¯æå³ãããã¾ãããããã¦ãããã®ææ¡ã®å¤ãã¯ãã§ã«æ¤è¨ãããªã¸ã§ã¯ãããã¦ããçµç·¯ãããã¾ãã ãtryçµã¿è¾¼ã¿é¢æ°ããããã¼ã¶ã«ãªãããæ¤è¨ãããã¼ã¸ç´åãããã¾ã§é²ãã ãã¨ãããã¾ããããGoã®ã¨ã©ã¼ãã³ããªã³ã°ãã«ã¨ã£ã¦ä¸é·ä¸çãããã¾ããããã®æ¬ ç¹èª²é¡ã¯è§£æ±ºã§ããã«æçµçã«ãªã¸ã§ã¯ãããã¾ããã ãå¤å¤è¿ããã¯å®ã«CPUãã¬ã³ããªã¼ãªæ©æ§ã§ãCè¨èªã®é¢æ°å¼ã³åºãè¦ç´ã«ã¡ã
Go ã®ãã¥ã¼ããªã¢ã«ãèªãã å¾ãå®éã®éçºã«å ¥ãããã«å¿ è¦ãªæ å ±ãã¾ã¨ããè³æã§ãã
ç°å¢æ§ç¯ããã¾ã§ã«ç¥ãããã£ãã㨠Golangã®ææ°ãã¼ã¸ã§ã³ã¯ï¼ 1.16.6 (2020/07/12ãªãªã¼ã¹) Goã®ã¤ã³ã¹ãã¼ã«æ¹æ³ã¯? macOS ã®å ´å㯠brew 㧠OK ãã®å ´åãgoã®sdk㯠/usr/local/Cellar/go/<ãã¼ã¸ã§ã³>/libexec ã«ã¤ã³ã¹ãã¼ã«ããã¾ãã IntelliJ IDEA ã GoLand ã«ãã㪠IDE ã«ãGOROOTãã¨ãããã®ã®æå®ãæ±ãããããããã®ãã¹ã使ãã¾ãã brew ã§å ¥ããªããã¼ã¸ã§ã³ã® go ãå¿ è¦ã ã£ãããããã¤ãã®ãã¼ã¸ã§ã³ãä½µç¨ãããå ´å㯠$ go get golang.org/dl/go1.14.4 $ go1.14.4 download # 1.xx.0 ã®å ´å $ go get golang.org/dl/go1.15 $ go1.15 download # ä¸è¨ã§go getããg
#NGINXã£ã¦ï¼ï¼ ç°¡åã«NGINXã®ç¹å¾´ã«ã¤ãã¦èª¬æãã¾ãï¼ ã¤ãã³ãé§åã®Webãµã¼ãã¼ éçã³ã³ãã³ãã®é ä¿¡ãå¾æ ãªãã¼ã¹ãããã·ã¨ãã¦ä½¿ããããã¨ãå¤ã å ¨ã¢ã¯ãã£ããµã¤ãã®ä¸ã§2çªç®ã«å¤ã使ããã¦ãã(19.60%) åè:wikipedia nginx 以å(ã¨ãã£ã¦ãã ãã¶åã§ãã)ã¯Apacheãä¸å¼·ã®ãµã¼ãã¼æ¥çã§ããï¼ç§ãããã¾ã詳ãããªãã§ããï¼ãµã¼ãã¼ãå®ããªãä¸ï¼C10Kåé¡ã¨ãããã®ãæ¥çã§è©±é¡ã«ãªãï¼Apacheãæ¡ç¨ãã¦ããpre-Forkåã®ã¢ã¼ããã¯ãã£ã®ãµã¼ãã¼ã§ã¯å¤§éã®ãªã¯ã¨ã¹ããå¦çã§ããªããªã£ã¦ãã¾ããï¼ãã®ä¸ã§ï¼ã¤ãã³ãé§ååã®ã¢ã¼ããã¯ãã£ã®NGINXã大éã®ãªã¯ã¨ã¹ããå¦çãããã¨ãå¯è½ã§ï¼æ³¨ç®ãæµ´ã³ãããã§ãï¼ ããã§ï¼Webãµã¼ãã¹ã®ãªã¯ã¨ã¹ãã®ä¸çªæåãNGINXãåãï¼ãªãã¼ã¹ãããã·ãããï¼ã¨ããæ§æãããåãããããã§ãï¼ã¾
Goè¨èª ã£ã¦ã¶ã£ã¡ããã話ã©ãï¼Goè¨èªéçºè ãæ¬é³ãèªã£ã Geeks Who Drink in Tokyo ãã¬ãã¼ãï¼ 2017å¹´6æ23æ¥ã«ãã¼ã©ãæ±äº¬ãªãã£ã¹ã«ã¦ã Geeks Who Drink in TokyoâGo Go Golang Edition!ããéå¬ãã¾ããï¼æ¬ã¤ãã³ãã¯ã6æ28æ¥ã«ç¦å²¡ã§éå¬ãããã Geeks Who Drink in Fukuoka -Go Go Golang Edition!-ãã®ãã¼ãã·ã§ã¼ã¤ãã³ãã§ããå®éã®éçºã§Goã使ã£ã¦ãã Goè¨èªéçºè ããä»å¾ä½¿ãããï¼ã¨ããæ¹ãéã¾ããæ§ã ãªè¦ç¹ã§Goè¨èªã使ã£ãéçºã«é¢ãããã¦ãã¦ãå ±æãã¾ãããè°è«ãç½ç±ããã¤ãã³ã模æ§ããå±ããã¾ãã å ¨å¡ã§ãGo Go Golang!ãã®æã声ã¨å ±ã«åçãæ®ãã¾ããï¼ ä»è¨èªã¨æ¯è¼ããGoè¨èªã®è¯ãæªãåã³å¦ç¿ã«ã¤ã㦠æåã«ç»å£ããã®ã¯ãæ¥æ¬
çµè«ã¨ãã¦ã¯Goè¨èªã«ã¯ä»¥ä¸ã®ãããªããã¤ãã®é·æããããç¾å®è·¯ç·ã§é常ã«ãã©ã³ã¹ãã¨ããè¨èªã ã¨æãã¾ãã ãããã®é·æã®ããã«å¤±ãããã¡ãªãããå½ç¶ããã¤ãããã¾ãããä¸å®ç¨åº¦ä»¥ä¸ã®è¦æ¨¡ã®ããã¸ã§ã¯ãã§å©ç¨ããè¨èªã®é¸æè¢ã¨ãã¦ã¯ç¾åããããã°ã©ãã³ã°è¨èªã®ä¸ã§ã¯ä¸çªãäºçªç®ã«ããã®ã§ã¯ãªããã¨æãã¾ãã ã³ã³ãã¤ã«ãéã (vs. C++) GCã¨ã¡ã¢ãªå®å ¨æ§ (vs. C++) 妥å½ã§ç¾å®çãªã¬ãã«ã®åå®å ¨æ§ (vs. Python/Ruby) å®è¡æããã©ã¼ãã³ã¹ãè¯ã (vs. Python/Ruby) ç¾å®åé¡ãããç¨åº¦ã®è¦æ¨¡ã¨æéã®ããã¸ã§ã¯ãã«ãªãã¨åæ¤è¨¼ãããã¨ãªãã¡ã¯ã¿ãªã³ã°ãªã©ãã ãã¶æ¥½ã«ãªãã®ã§ãããããã åãããã®ã§èªç¶ã¨å®è¡æããã©ã¼ãã³ã¹ãè¯ã æ¨æºã©ã¤ãã©ãªãæ´åããã¦ãã (vs. C++) ãããæ¨æºã©ã¤ãã©ãªã«jsonã®parserããåå¨ããªãC
ååãGoãå§ããä¸ã§ãæ¡å¤ã¾ã¨ã¾ã£ãè³æãç¡ãããã ã£ãã®ã§æ¸ãã¦ã¿ããã¨ã«ãã¾ããã Macã§homebrewãå ¥ã£ã¦ãããã¨ãåæã§ããäºåã« brew update ããããªã formula ãææ°ã®ãã®ã«ãã¦ããã¨èºããã¨ãå°ãªãã§ãããã Goã®ã¤ã³ã¹ãã¼ã« % brew install go ã¨ã³ããªå·çæç¹ã§ã¯ã1.6.2 ãå ¥ãã¾ããGoã¯ã¡ã¸ã£ã¼ãã¼ã¸ã§ã³ãåãå ´åã¯ãå¾æ¹äºæãä¿ããã¦ããã®ã§ãåºæ¬çã«æ°ãããã¤ãå ¥ãã¦åé¡ããã¾ããã ç°å¢å¤æ°ã®è¨å® $GOPATH ã ãã決ããã°OKã§ãã$GOPATH ã¯ã©ãã§ãè¯ãã®ã§ãããããã§ã¯ $HOME/dev ã $GOPATH ã«è¨å®ãã¾ããã¾ãã $GOPATH/bin ã« $PATH ãéãã¦ããã¾ãã export GOPATH=$HOME/dev export PATH=$GOPATH/bin:$PATH
Go1.5ã¨Go1.6ã§Goã®GCã®ã¬ã¤ãã³ã·ã大ããæ¹åãããï¼ãã®å¤æ´ã«ã¤ãã¦ãã¡ããã¨ãç解ããããï¼ã¢ã«ã´ãªãºã ã¬ãã«ã§Goã®GCã«ã¤ãã¦è¿½ã£ã¦ã¿ãï¼ ã¾ãGoã®GCã®ç¾ç¶ãããã©ã¼ãã³ã¹ï¼ã¬ã¤ãã³ã·ï¼ã®è¦³ç¹ããã¾ã¨ããï¼æ¬¡ã«å ·ä½çãªã¢ã«ã´ãªãºã ã«ã¤ãã¦ï¼ããã¦æå¾ã«å®éã®ç¾å ´ã§ã®ãã¥ã¼ãã³ã°ã¯ã©ãããã°è¯ãã®ãã«ã¤ãã¦è§£èª¬ããï¼ Goã®GCã®ä» æåã«Goã®GCã®æè¿ã®æµãï¼2016å¹´5æã¾ã§ï¼ãã¾ã¨ããï¼ Go1.4ã¾ã§ã¯åç´ãªStop The Worldï¼STWï¼GCãå®è£ ããã¦ãããGo1.5ããã¯æ°ããªGCã¢ã«ã´ãªãºã ãå°å ¥ãããï¼å°å ¥ã®éã«è¨å®ãããæ°å¤ç®æ¨ã¯å¤§ããªãã¼ããµã¤ãºã«ããã¦ãã¬ã¤ãã³ã·ã10ms以ä¸ã«æãããã¨ã§ãã£ãï¼Go1.5ã§æ°ããªã¢ã«ã´ãªã ãå®è£ ããGo1.6ã§æé©åãè¡ãããï¼ ä»¥ä¸ã¯å ¬éããã¦ãããã³ããã¼ã¯ï¼ã¾ãã¯Go1.5ãè¦ãï¼ Gophe
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}