1. ã¯ããã«
è¿å¹Žãããã°ã©ãã³ã°èšèªãšããŠã®Goèšèªã®äººæ°ãæ¥äžæããŠããŸããç¹ã«Webã¢ããªã±ãŒã·ã§ã³ã®éçºã«ãããŠããã®ããã©ãŒãã³ã¹ãšå¹çæ§ãé«ãè©äŸ¡ãããŠããŸãã
1.1 Goèšèªãšã¯
Goèšèªãé称ãGoãã¯GoogleãéçºãããªãŒãã³ãœãŒã¹ã®ããã°ã©ãã³ã°èšèªã§ããã·ã³ãã«ã§èªã¿ãããææ³ãç¹åŸŽã§ã䞊è¡åŠçãåŸæãšããŠããŸããããã«ãããé«éãªã¢ããªã±ãŒã·ã§ã³ã®éçºãå¯èœãšãªã£ãŠããŸãã
1.2 ãã¬ãŒã ã¯ãŒã¯ã®éèŠæ§
ãã¬ãŒã ã¯ãŒã¯ã¯ãã¢ããªã±ãŒã·ã§ã³ã®éçºãå¹ççã«é²ããããã®ããŒã«ã®äžã€ã§ããç¹ã«ãåå©çšå¯èœãªã³ãŒãã®ã»ããããäžè¬çãªã¢ããªã±ãŒã·ã§ã³ã®æ§é ãæäŸããŠããããããéçºè ã¯åºæ¬çãªéšåã®ã³ãŒãã£ã³ã°ãã解æŸãããæ¬æ¥ã®éçºã«éäžããããšãã§ããŸãã
2. Goãã¬ãŒã ã¯ãŒã¯ã®åºç€
Goèšèªã®ãã¬ãŒã ã¯ãŒã¯ã¯å€æ°ååšããŸãããããããã«ç¹è²ãå©ç¹ããããŸããããã§ã¯ããã¬ãŒã ã¯ãŒã¯ã®åºæ¬çãªæŠå¿µããGoèšèªã«ããããã¬ãŒã ã¯ãŒã¯ã®ã¡ãªããã»ãã¡ãªããã«ã€ããŠè§£èª¬ããŸãã
2.1 ãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãªã®éã
ãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãªã¯ããã䌌ãæŠå¿µãšããŠæ±ãããããšãå€ãã§ãããå®éã«ã¯ç°ãªããã®ã§ããã©ã€ãã©ãªã¯ãç¹å®ã®æ©èœãå®çŸããããã®ã³ãŒãã®éãŸãã§ãããéçºè ãå¿ èŠã«å¿ããŠå©çšãããã®ã§ããäžæ¹ããã¬ãŒã ã¯ãŒã¯ã¯ã¢ããªã±ãŒã·ã§ã³ã®åºæ¬çãªæ§é ãæäŸãããã®äžã§ã®éçºãè¡ããã®ã§ããã€ãŸããã©ã€ãã©ãªã¯ãã¬ãŒã ã¯ãŒã¯ã®äžã§äœ¿çšãããããšãå€ããšèšããŸãã
2.2 Goãã¬ãŒã ã¯ãŒã¯ã®ã¡ãªãã
Goèšèªã®ãã¬ãŒã ã¯ãŒã¯ã䜿çšããæ倧ã®ã¡ãªããã¯ãéçºé床ã®åäžã§ãããã¬ãŒã ã¯ãŒã¯ã«ã¯ãWebã¢ããªã±ãŒã·ã§ã³ã®éçºã«å¿ èŠãªåºæ¬çãªæ©èœãäºãçµã¿èŸŒãŸããŠãããããéçºè ã¯ãããããŒã¹ã«æ©èœã®è¿œå ãã«ã¹ã¿ãã€ãºãè¡ãããšãã§ããŸãã
2.3 Goãã¬ãŒã ã¯ãŒã¯ã®ãã¡ãªãã
äžæ¹ã§ããã¬ãŒã ã¯ãŒã¯ã«ã¯ãã¡ãªãããååšããŸããäŸãã°ãåŠç¿ã³ã¹ãããããããšãããã¬ãŒã ã¯ãŒã¯åºæã®æ¹æ³ã«çžãããããšãæããããŸãããããããã®ãã¡ãªãããäžåãã¡ãªãããå€ããããå€ãã®éçºè ããã¬ãŒã ã¯ãŒã¯ãå©çšããŠããŸãã
2. Goãã¬ãŒã ã¯ãŒã¯ã®åºç€
ããã°ã©ãã³ã°ã®äžçã«ã¯ãå¹ççãªéçºããµããŒãããããã®å€ãã®ããŒã«ãã©ã€ãã©ãªãååšããŸããGoèšèªãäŸå€ã§ã¯ãªããæ§ã ãªãã¬ãŒã ã¯ãŒã¯ãæäŸãããŠããŸãããããããããã®ããŒã«ãå¹æçã«äœ¿çšããããã«ã¯ãããããã®ç¹æ§ãéããç解ããããšãäžå¯æ¬ ã§ãã
2.1 ãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãªã®éã
ãã¬ãŒã ã¯ãŒã¯ãšã©ã€ãã©ãªã¯ãå€ãã®éçºè ã«ãšã£ãŠæ··åããããæŠå¿µã§ããã©ã€ãã©ãªã¯ãç¹å®ã®ã¿ã¹ã¯ãæ©èœãå®çŸããããã®ã³ãŒãã®éåäœã§ãããããå©çšããããšã§ãéçºè ã¯ç¹°ãè¿ãåãã³ãŒããæžãæéãçãããšãã§ããŸããäžæ¹ããã¬ãŒã ã¯ãŒã¯ã¯ãã¢ããªã±ãŒã·ã§ã³ã®åºæ¬çãªæ§é ãæµããæäŸãããã®ã§ããããã«ãããçµ±äžãããéçºç°å¢ã®äžã§ãå¹ççã«ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããšãå¯èœãšãªããŸãã
2.2 Goãã¬ãŒã ã¯ãŒã¯ã®ã¡ãªãã
Goèšèªã®ãã¬ãŒã ã¯ãŒã¯ã䜿çšããããšã®ã¡ãªããã¯æ°å€ããããŸãããŸããéçºã®è¿ éåãæããããŸãããã¬ãŒã ã¯ãŒã¯ã«ã¯ãå€ãã®åºæ¬çãªæ©èœãäºãçµã¿èŸŒãŸããŠããããããããå©çšããããšã§éçºæéãå€§å¹ ã«ççž®ããããšãã§ããŸãããŸããå質ã®åäžã倧ããªã¡ãªããã®äžã€ã§ãããã¬ãŒã ã¯ãŒã¯ã«ã¯ãå€ãã®ãã¹ããã©ã¯ãã£ã¹ãåãå ¥ããããŠããããããããããŒã¹ã«éçºãè¡ãããšã§ãé«å質ãªã¢ããªã±ãŒã·ã§ã³ãäœæããããšãå¯èœãšãªããŸãã
2.3 Goãã¬ãŒã ã¯ãŒã¯ã®ãã¡ãªãã
äžæ¹ãGoãã¬ãŒã ã¯ãŒã¯ã䜿çšããããšã®ãã¡ãªãããååšããŸãããã®äžã§ããåŠç¿ã³ã¹ããé«ãããšãæããããŸããæ°ãããã¬ãŒã ã¯ãŒã¯ãåŠã¶ããã«ã¯ããã®ä»çµã¿ã䜿çšæ¹æ³ãç解ããå¿ èŠããããããã«ã¯æéããããããšãå€ãã§ãããŸãããã¬ãŒã ã¯ãŒã¯ã«ã¯ç¬èªã®æ¹æ³ãã«ãŒã«ãååšãããããããã«çžãããããšã§ãæè»ãªéçºãé£ãããªãããšããããŸãã
3. 人æ°ã®Goãã¬ãŒã ã¯ãŒã¯çŽ¹ä»
Goèšèªã®ãšã³ã·ã¹ãã ã¯æ¥ã æé·ãç¶ããŠãããå€ãã®ãã¬ãŒã ã¯ãŒã¯ãéçºè ã®å©çšãåŸ ã£ãŠããŸããããã§ã¯ãçŸåšç¹ã«äººæ°ã®ããGoãã¬ãŒã ã¯ãŒã¯5ã€ãããã¯ã¢ããããããããã®ç¹åŸŽãå©ç¹ã玹ä»ããŸãã
3.1 Echo
Echoã¯ãé«éã§å¹ççãªGoãã¬ãŒã ã¯ãŒã¯ãšããŠç¥ãããŠããŸããã·ã³ãã«ãªAPIãšåŒ·åãªã«ãŒãã£ã³ã°æ©èœãæã¡ãRESTfulãªAPIã®éçºã«é©ããŠããŸãããŸããããã«ãŠã§ã¢ã®ãµããŒãããèªåçãªãšã©ãŒãã³ããªã³ã°ãªã©ã®æ©èœãåããŠãããåå¿è ããäžçŽè ãŸã§å¹ åºãå©çšãããŠããŸãã
3.2 Gin
Ginã¯ãEchoãšåæ§ã«é«éãªWebãã¬ãŒã ã¯ãŒã¯ãšããŠã®è©äŸ¡ãé«ãã§ããç¹ã«ãJSONã®ã¬ã³ããªã³ã°é床ãéåžžã«é«ããAPIã®éçºã«æé©ã§ãããŸããç¬èªã®ããã«ãŠã§ã¢ã·ã¹ãã ãæã¡ãã«ã¹ã¿ãã€ãºã®èªç±åºŠãé«ãã®ãç¹åŸŽã§ãã
3.3 Beego
Beegoã¯ãMVCã¢ãŒããã¯ãã£ãæ¡çšãããã¬ãŒã ã¯ãŒã¯ã§ããçµã¿èŸŒã¿ã®ORMããèªåçãªAPIããã¥ã¡ã³ãçææ©èœãªã©ãå€ãã®æ©èœãäžã€ã®ãã¬ãŒã ã¯ãŒã¯ã«çµ±åãããŠããŸããããã«ãããäžè²«ããéçºç°å¢ã®äžã§ãå¹ççãªã¢ããªã±ãŒã·ã§ã³ã®éçºãå¯èœãšãªããŸãã
3.4 Revel
Revelã¯ãèšå®äžèŠã§å³åº§ã«åäœããGoã®ãã«ã¹ã¿ãã¯ãã¬ãŒã ã¯ãŒã¯ã§ããããããªããŒãæ©èœããå€ãã®ãã©ã°ã€ã³ã®ãµããŒããªã©ãéçºè ã®çç£æ§ãåäžãããæ©èœãè±å¯ã«åããããŠããŸãã
3.5 Gorilla
Gorillaã¯ãGoã®Webã¢ããªã±ãŒã·ã§ã³éçºã®ããã®è»œéãªãã¬ãŒã ã¯ãŒã¯ã§ããç¹ã«ãWebãœã±ãããã»ãã·ã§ã³ç®¡çãªã©ã®æ©èœã匷åãããŠããããªã¢ã«ã¿ã€ã ãªWebã¢ããªã±ãŒã·ã§ã³ã®éçºã«é©ããŠããŸãã
äºè§£ããŸããã以äžã¯ãGoãã¬ãŒã ã¯ãŒã¯ã®éžã³æ¹ãã«é¢ããã»ã¯ã·ã§ã³ã®å 容ã§ãïŒ
—
“`html
4. Goãã¬ãŒã ã¯ãŒã¯ã®éžã³æ¹
Goèšèªã®ãã¬ãŒã ã¯ãŒã¯ã¯å€çš®å€æ§ã§ããããããç°ãªãç¹åŸŽãæ©èœãæã£ãŠããŸãããã®ãããé©åãªãã¬ãŒã ã¯ãŒã¯ãéžæããããšã¯ããããžã§ã¯ãã®æåã«çŽçµããŸããããã§ã¯ããã¬ãŒã ã¯ãŒã¯ãéžã¶éã®ãã€ã³ãã3ã€ã®èŠ³ç¹ãã玹ä»ããŸãã
4.1 ãããžã§ã¯ãã®èŠæš¡ãšç®ç
ãŸãããããžã§ã¯ãã®èŠæš¡ãšç®çãæ確ã«ããããšãéèŠã§ããå°èŠæš¡ãªãããžã§ã¯ããã·ã³ãã«ãªAPIã®éçºã§ããã°ã軜éã§ã·ã³ãã«ãªãã¬ãŒã ã¯ãŒã¯ãé©ããŠããŸããäžæ¹ã倧èŠæš¡ãªãããžã§ã¯ããè€éãªæ©èœãæã€ã¢ããªã±ãŒã·ã§ã³ã®éçºã«ã¯ãå€æ©èœãªãã¬ãŒã ã¯ãŒã¯ããæ¡åŒµæ§ã®é«ããã¬ãŒã ã¯ãŒã¯ãå¿ èŠãšãªãã§ãããã
4.2 ã³ãã¥ããã£ãšãµããŒã
ãã¬ãŒã ã¯ãŒã¯ã®éžæã«ãããŠãã³ãã¥ããã£ã®æŽ»çºãããµããŒãäœå¶ã倧ããªèŠå ãšãªããŸãã掻çºãªã³ãã¥ããã£ãæã€ãã¬ãŒã ã¯ãŒã¯ã¯ããã°ã®ä¿®æ£ãæ°æ©èœã®è¿œå ãè¿ éã«è¡ãããåŸåããããŸãããŸããå€ãã®ãŠãŒã¶ãŒãããããšã§ã質åããã©ãã«ã·ã¥ãŒãã£ã³ã°ã®éã«æ å ±ãåŸããããªããŸãã
4.3 ããã©ãŒãã³ã¹ãšæ¡åŒµæ§
æåŸã«ãããã©ãŒãã³ã¹ãšæ¡åŒµæ§ããã¬ãŒã ã¯ãŒã¯éžã³ã®éèŠãªãã€ã³ãã§ããé«éãªã¬ã¹ãã³ã¹ãæ±ããããã¢ããªã±ãŒã·ã§ã³ã®å Žåãããã©ãŒãã³ã¹ã®é«ããã¬ãŒã ã¯ãŒã¯ãéžæããããšãå¿ èŠã§ãããŸããå°æ¥çã«æ°ããæ©èœãè¿œå ããå¯èœæ§ãããå Žåã¯ãæ¡åŒµæ§ã®é«ããã¬ãŒã ã¯ãŒã¯ãéžã¶ããšã§ãéçºã®æè»æ§ãä¿ã€ããšãã§ããŸãã
“`
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãGoèšèªã®ãã¬ãŒã ã¯ãŒã¯ãéžæããéã®èæ ®ç¹ããã€ã³ãã«ã€ããŠè©³ãã解説ããŠããŸãã
5. å®è·µ: Goãã¬ãŒã ã¯ãŒã¯ã§ã®ã¢ããªã±ãŒã·ã§ã³éçº
çè«çãªç¥èãåŠã¶ã ãã§ãªããå®éã«æãåãããŠã¢ããªã±ãŒã·ã§ã³ãéçºããããšã§ãGoãã¬ãŒã ã¯ãŒã¯ã®é åã匷åããå®æããããšãã§ããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãGoãã¬ãŒã ã¯ãŒã¯ã䜿çšããã¢ããªã±ãŒã·ã§ã³ã®éçºæé ãã¹ããããã€ã¹ãããã§è§£èª¬ããŸãã
5.1 éçºç°å¢ã®ã»ããã¢ãã
ãŸãã¯ãéçºç°å¢ã®ã»ããã¢ããããå§ããŸããGoèšèªã®å ¬åŒãµã€ãããææ°ã®ããŒãžã§ã³ãããŠã³ããŒãããã€ã³ã¹ããŒã«ããŸãã次ã«ãéžæãããã¬ãŒã ã¯ãŒã¯ã®ããã¥ã¡ã³ããåèã«ãå¿ èŠãªããã±ãŒãžãããŒã«ãã€ã³ã¹ããŒã«ããŸãããã®æ®µéã§ç°å¢å€æ°ã®èšå®ãããã£ã¬ã¯ããªæ§é ã®ç¢ºèªãè¡ã£ãŠãããŸãããã
5.2 ãµã³ãã«ã¢ããªã±ãŒã·ã§ã³ã®äœæ
éçºç°å¢ãæŽã£ããããµã³ãã«ã¢ããªã±ãŒã·ã§ã³ã®äœæã«ç§»ããŸããããã§ã¯ãã·ã³ãã«ãªWebã¢ããªã±ãŒã·ã§ã³ãäŸã«ãã«ãŒãã£ã³ã°ã®èšå®ãã³ã³ãããŒã©ãŒã®äœæãªã©ãåºæ¬çãªéçºãããŒãåŠã³ãŸãããŸãããã³ãã¬ãŒããšã³ãžã³ã䜿çšããŠãåçãªã³ã³ãã³ãã®è¡šç€ºãè©Šã¿ãŸãã
5.3 ããŒã¿ããŒã¹ãšã®é£æº
å€ãã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ãããŒã¿ããŒã¹ãšã®é£æºãäžå¯æ¬ ã§ããGoãã¬ãŒã ã¯ãŒã¯ã§ã¯ãORMïŒObject-Relational MappingïŒãå©çšããŠãããŒã¿ããŒã¹ãšã®ããåããå¹ççã«è¡ãããšãã§ããŸããããã§ã¯ãããŒã¿ããŒã¹ã®ã»ããã¢ãããããCRUDæäœã®å®è£ ãŸã§ã解説ããŸãã
5.4 ãã¹ããšãããã°
ã¢ããªã±ãŒã·ã§ã³ã®éçºãäžæ®µèœãããããã¹ããšãããã°ã®ãã§ãŒãºã«å ¥ããŸããGoèšèªã«ã¯ãçµã¿èŸŒã¿ã®ãã¹ããã¬ãŒã ã¯ãŒã¯ãæäŸãããŠããããããå©çšããŠãŠããããã¹ããçµ±åãã¹ããè¡ãããšãã§ããŸãããŸãããããã°ããŒã«ã䜿çšããŠãã¢ããªã±ãŒã·ã§ã³ã®åäœã確èªããªããããšã©ãŒãäžå ·åãä¿®æ£ããŠãããŸãã
6. äžçŽè åã: Goãã¬ãŒã ã¯ãŒã¯ã®æé©åãšæ¡åŒµ
Goãã¬ãŒã ã¯ãŒã¯ã䜿ã£ãåºæ¬çãªã¢ããªã±ãŒã·ã§ã³éçºã«æ £ãããã次ã¯ãã®æé©åãšæ¡åŒµã«ææŠããŠã¿ãŸãããããã®ã»ã¯ã·ã§ã³ã§ã¯ãããé«åºŠãªãã¯ããã¯ããã¹ããã©ã¯ãã£ã¹ã玹ä»ããŸãã
6.1 ããã«ãŠã§ã¢ã®å©çš
ããã«ãŠã§ã¢ã¯ããªã¯ãšã¹ããšã¬ã¹ãã³ã¹ã®éã«æãŸããåŠçã®ããšãæããŸããäŸãã°ããã°ã®èšé²ãèªèšŒããã£ãã·ã¥ãªã©ã®æ©èœãå®çŸããããã«ããã«ãŠã§ã¢ãå©çšããããšãã§ããŸããå€ãã®Goãã¬ãŒã ã¯ãŒã¯ã§ã¯ãããã«ãŠã§ã¢ãç°¡åã«è¿œå ã»çµã¿èŸŒãããšãã§ããã®ã§ãã¢ããªã±ãŒã·ã§ã³ã®æ©èœæ¡åŒµãæé©åã«åœ¹ç«ã¡ãŸãã
6.2 ã»ãã¥ãªãã£ã®åŒ·å
Webã¢ããªã±ãŒã·ã§ã³ã®ã»ãã¥ãªãã£ã¯éåžžã«éèŠã§ããGoãã¬ãŒã ã¯ãŒã¯ã䜿çšããéããSQLã€ã³ãžã§ã¯ã·ã§ã³ãã¯ãã¹ãµã€ãã¹ã¯ãªããã£ã³ã°ïŒXSSïŒãªã©ã®è åšããã¢ããªã±ãŒã·ã§ã³ãå®ãããã®å¯Ÿçãå¿ èŠã§ããã»ãã¥ãªãã£ããããŒã®èšå®ããå ¥åå€ã®ããªããŒã·ã§ã³ãã»ãã·ã§ã³ç®¡çã®åŒ·åãªã©ãããŸããŸãªã»ãã¥ãªãã£å¯Ÿçãå®æœããŠãã¢ããªã±ãŒã·ã§ã³ãããå®å šã«éçšããŸãããã
6.3 ããã©ãŒãã³ã¹ãã¥ãŒãã³ã°
ã¢ããªã±ãŒã·ã§ã³ã®ããã©ãŒãã³ã¹ã¯ããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ã«çŽçµããŸããGoãã¬ãŒã ã¯ãŒã¯ã䜿çšããéããããŒã¿ããŒã¹ã®æé©åããã£ãã·ã¥ã®å©çšãéçãã¡ã€ã«ã®å§çž®ãªã©ãããŸããŸãªææ³ãé§äœ¿ããŠã¬ã¹ãã³ã¹é床ãåäžãããããšãã§ããŸãããŸãããããã¡ã€ãªã³ã°ããŒã«ã䜿çšããŠãã¢ããªã±ãŒã·ã§ã³ã®ããã«ããã¯ãç¹å®ããããã解æ¶ããããšã§ããããªãããã©ãŒãã³ã¹ã®åäžãç®æããŸãããã
7. ãŸãšããšä»åŸã®åŠã³ã®ã¹ããã
ãã®èšäºãéããŠãGoãã¬ãŒã ã¯ãŒã¯ã®åºç€ããäžçŽè åãã®ãã¯ããã¯ãŸã§ãå¹ åºãåŠã¶ããšãã§ããŸãããGoèšèªã¯ãã®ããã©ãŒãã³ã¹ãã·ã³ãã«ãããå€ãã®éçºè ã«æ¯æãããŠããããã®äžã§ããã¬ãŒã ã¯ãŒã¯ã¯Webã¢ããªã±ãŒã·ã§ã³éçºã®å¹çã倧ããåäžãããããŒã«ãšããŠæ³šç®ãããŠããŸãã
ããããæè¡ã®äžçã¯æ¥ã é²åããŠããŸããä»åŠãã ç¥èããæãšãšãã«æ°ããæ å ±ãæè¡ã«åã£ãŠä»£ããããå¯èœæ§ããããŸãããã®ãããåžžã«ææ°ã®æ å ±ãè¿œãæ±ããåŠã³ç¶ãã姿å¢ã倧åã§ãã
ä»åŸã®åŠã³ã®ã¹ããã:
1. å®éã®ãããžã§ã¯ãã§ã®é©çš: ç¥èãå®éã®ãããžã§ã¯ãã«é©çšããããšã§ãç解ãæ·±ããããšãã§ããŸãã
2. ã³ãã¥ããã£ãžã®åå : Goèšèªããã¬ãŒã ã¯ãŒã¯ã«é¢ããã³ãã¥ããã£ã«åå ããä»ã®éçºè ãšæ å ±äº€æãããããšã§ãæ°ããç¥èãæè¡ãåŸãããšãã§ããŸãã
3. å ¬åŒããã¥ã¡ã³ãã®èªè§£: ãã¬ãŒã ã¯ãŒã¯ã®å ¬åŒããã¥ã¡ã³ããå®æçã«èªãããšã§ãææ°ã®æ å ±ãå€æŽç¹ããã£ããã¢ããããããšãã§ããŸãã
4. é¢é£æè¡ã®åŠç¿: Goãã¬ãŒã ã¯ãŒã¯ã ãã§ãªããé¢é£ããããŒã¿ããŒã¹æè¡ãããã³ããšã³ãæè¡ãªã©ãå¹ åºãæè¡ã®åŠç¿ãé²ããããšã§ãããé«åºŠãªã¢ããªã±ãŒã·ã§ã³éçºãå¯èœãšãªããŸãã
æåŸã«ãæè¡ã®åŠã³ã¯çµããããããŸãããæ°ããææŠãæãããåžžã«ååããªå§¿å¢ã§åŠã³ç¶ããããšã§ãããåªããéçºè ãšãªãããšãã§ããã§ãããã