è¨ããã¨ç¥ããæ¸ç±ãã¿ããªã®Goè¨èªããçºå£²ç´å¾ãããã«è³¼å ¥ãã¦ã¯ãããã ãã©ãç®æ¬¡ãããããã©ãã©è¦ã¦ãããããã¯2,3æ¥éä¸ãã¦ã¬ãã¨ãããããªããã¤ã ãã¨æã£ã¦ãã§ãã¿ã¤ãã³ã°ãè¦è¨ãã£ã¦ãããã¡ã«å¹´æ«å¹´å§ä¼æã«çªå ¥ãã¦ãã¾ã£ãã®ã ãã©ããã®ã¿ã¤ãã³ã°ã§ã¡ããã¨ãã¬ããã¨ã§ããã®ã§ãä»æ¥ã¯ãã®ã話ãã°ã
å㨠Go è¨èª
åã® Go è¨èªéæ´ã«ã¤ãã¦å°ãã ã触ãã¦ããã
以åãå人çã«ã¡ãã£ã¨ä½ã£ã¦ã¿ãããã¼ã«ããã£ãææããã£ã¦ããã®ã¨ãæ¢ã« Go ããããããã¦ã¯ãããã¦ãããã¨ããã£ã¦ããã®ãã¼ã«ã¯ Go ã§æ¸ãã¦ã¿ã¦ãããâããªãã¸ããªãªãã ãã©ï¼ã³ããããã°ãè¦ã¦ã¿ãã first commit ã¯2014å¹´11æã ã£ãï¼ãã ãã¶ã²ã©ãæ¸ãæ¹ããã¦ãã¨æãã®ã§é²è¦§æ³¨æã§ãï½
ãã ãå®éã«ãã£ã¦ã¿ã¦ã®ææ³ã¨ãã¦ã¯ãããã£ã¬ã¯ããªæ§æã¨ãããã±ã¼ã¸ã®åãæ¹ã¨ãããã£ã±ãããããããã»ãªãªã¼ã©ããã«æ¸ãã¦ã¿ããã£ããã©ããã®ã»ãªãªã¼ããããããã¨ãã£ããã®ã§ããã¨ãã£ã¦ãã®çåã«å¿ãã¦ããããã®ã«åºä¼ããã¨ãã§ãããçµå±ãã®ã¾ã¾æ¾ã£ããããã«ãã¦ãã¾ã£ã¦ããã
ãã§ã«èªãã 人ã¯ãããã¨æããã©ããã¿ããªã® Go è¨èªãã¯ã¾ãã«ããããç¹ã«ã¤ãã¦æ¸ããã¦ããæ¬ï¼ç¹ã«ç¬¬1ç« ãè¯ãã£ãï¼ãªã®ã§ã2å¹´ã¨ããæãè¶ãã¦åã®çåã«å¿ãã¦ãããæ¬ãåºãï¼ã¨ããæãã§ãããããæå³ã§ãå¾ æã®ä¸åã ã£ãã
ãã®æ¬ãèªãã§ããã£ã¦ã¿ãããã¨æã£ããã¨ã»ãã£ããã¨
ã§ããã®æ¬ãä¸éãèªãã§ã¿ã¦ãåã¯ä»¥ä¸ã®ãããªãã¨ããããããï¼ãã¨æã£ãã
- ï¼å¦ç¿ç®çã¨å²ãåã£ã¦ãã¾ã£ã¦ããã®ã§ãï¼ãªã«ã CLIãã¼ã«ãä½ã
- ã¡ããã¨ãã¹ããæ¸ã㦠CI ãåãï¼lint ãã«ãã¬ãã¸ãï¼
- Go ã®ã¯ãã¹ã³ã³ãã¤ã«ã®æ©æµã«é ãã£ã¦ã¿ãã
- Mac / Windows/ Linux ãã©ã®ç°å¢ã§ãåä½ãããã¤ããªããªãªã¼ã¹ããã
- GitHub ã® releases ã¾ãããããããã£ã¦ãªãã£ãã®ã§ããããã¸ããã¤ãã§ã«è§¦ã£ã¦ã¿ãã
ã§ãããããå®éã«ãããã¨ãã§ããã®ã§ãã²ã¨ã¤ãã¤ç´¹ä»ãã¦ããã
ãªã«ã CLIãã¼ã«ãä½ã
å¤åãããæåã«ãã¦ä¸çªã®ãã¼ãã«ã§ãåã®ããã«ãCLIãã¼ã«ãä½ã£ã¦ã¿ãããªããã¨æã人ã¯ãã£ã¨ãããããããã ãããã©ï¼ããããããã®æ¬ãèªãã 人ãªãå ¨å¡ãæãããããªãããªï¼ï¼ãããããä½ãCLIãã¼ã«ã¨ãã¦ä½ãã®ãï¼ãã¨ãªã£ãã¨ãã«ãã¼ã¢ã¤ãã¢ã§ãã£ããã·ã¥ã§ããã¨ãªã£ã¦ãã¾ãã®ã大åãªãã ã¨æãã
ããã ãã¯é¿ãããã®ã¨ããã¨ãã£ã¦ããã¾ãé£ããããã¨ããã§æãã¦ãã¾ãã®ã§ãã"èªå" ã«é¢ããCLIãã¼ã«ã a-know
ãä½ããã¨ã«ããããã¨æ±ºããã
ä¾ãã°ä»¥ä¸ã®ãããªæåããããããªãã¼ã«ããããªãä½ãããã§ããï¼ï½
$ a-know blog http://blog.a-know.me
å®éã®ä½æ¥ã¯ä»¥ä¸ã® p-rã
å®è£ ãå§ããã«ããã£ã¦ããã¿ããªã®Goè¨èªãã®ããã±ã¼ã¸åãã«ã¤ãã¦ã®è¨è¿°ãã¨ã¦ãåèã«ãªã£ãã
- Go ã§ããã°ã©ã ãæ¸ãå ´åã1ã¤ã®ãªãã¸ããªå ã«å¤æ°ã®ããã±ã¼ã¸ãå¿ è¦ã«ãªããã¨ã¯ãã¾ããªã
- CLIãã¼ã«ã®ãã¤ããªã®ã¿ãææç©ã¨ããå ´åã¯ãåç´ã«ã«ã¼ããã£ã¬ã¯ããªã« main ããã±ã¼ã¸ã®ã³ã¼ããé ç½®ãã
- ãã¤ããªãã¡ã¤ã³ã®ææç©ã¨ããåæã«ãã®ã©ã¤ãã©ãªãæä¾ãããå ´åã¯
lib
ãã£ã¬ã¯ããªãä½ãããã«ã©ã¤ãã©ãªã®ã³ã¼ããé ç½®ãã - ã©ã¤ãã©ãªãã¡ã¤ã³ã®ææç©ã¨ããåæã«ãã¤ããªãæä¾ããããããªå ´åã«ã¯
cmd/a-know
ã®ãããªãã£ã¬ã¯ããªãä½ãããã« main ããã±ã¼ã¸ã®ã³ã¼ããé ç½®ãã
ãã®ä»ã第4ç« ãã³ãã³ãã©ã¤ã³ãã¼ã«ãä½ããã®ã4.4 ãµãã³ãã³ããæã£ãCLIãã¼ã«ãã¨ã«ããã£ãããªãããå®è£ ãé²ããã
ã¡ããã¨ãã¹ããæ¸ã㦠CI ãåãï¼lint ãã«ãã¬ãã¸ãï¼
æåã®ãã¼ã«ãæ¸ããã¨ãã®å¼ãç®ã®ã²ã¨ã¤ãããã¹ããæ¸ãã¦ãªãã£ããã¨ã»æ¸ãæ¹ãããããããªãã£ããã¨ãã ã£ãã®ã§ãä»åã¯ãããã¡ããã¨ããããªã¨æã£ã¦ããã
ã§ããã£ãããã¹ããæ¸ãã®ãªã CI ãåããããã«ããããã100%ã®ã«ãã¬ãã¸ãï¼è¶£å³ã ããããï¼ç®æãããããã¨ã¯ä»äºæãGo ã®ã³ã¼ããæ¸ããã¨ãä»å¾å¢ãããã ã£ãã®ã§ãlint ãæãããã¨ã§ãGo ã®æ¸ãæ¹ãã身ã«ä»ããããã¨ãæã£ãã
å㯠CircleCI ããããªã®ã§ãããã使ã£ã¦ä¸è¿°ã®ãããªãã¨ã«ãã©ã¤ããã®ã以ä¸ã® p-rã
ãã¶ãã§ãã¦ãã¨æã...ãã
ã«ãã¬ãã¸ç®¡çã«ã¯ coveralls ã使ã£ã¦ãã¦ãã«ãã¬ãã¸ã®æ稿ã«ã¯ mattn ããã® goveralls ã使ã£ã¦ãããä¸è¿°ã®ã¨ãããä»å㯠CLIãã¼ã«ã®ãã¤ããªã®ã¿ãææç©ã¨ãã
ç®çãªã®ã§ main ããã±ã¼ã¸ã®ã¿ã§æ§æãããã³ã¼ãã¨ãããã ãã©ããããããè¤æ°ããã±ã¼ã¸æ§æã¨ããå ´åãcannot use test profile flag with multiple packages
ãåºãã£ã½ããæ®éã®ãã¹ãã ããªãããã±ã¼ã¸ãã¨ã«ãã¹ãããã°ããã ãã£ã½ããã©ãã«ãã¬ãã¸ãæ稿ããããã«ã¯åããã±ã¼ã¸ãã¨ã®ãããã¡ã¤ã«ãåºåããããã¨ã«ããããã¼ã¸ããå¿
è¦ãããããã ã£ãããåèã¾ã§ã
Go ã®ã¯ãã¹ã³ã³ãã¤ã«ã®æ©æµã«é ãã£ã¦ã¿ãã
ãã£ãã Go ã§ãã¼ã«ãæ¸ããã®ãªããã¯ãã¹ã³ã³ãã¤ã«ã§ãã£ã¦ç°å¢ãã¨ã®ãã¤ããªãçæããã¦ã¿ãããããæãã®ã¯äººã®ãµã¬ã£ã¦ããã§ãããï¼
ã¤ãã§ã«ããGitHub ã® releases ã§ãã¬ã¤ã«ãªãªã¼ã¹ããã¦ãã人ãã¨ããã®ããã£ã¨ç¾¨ã¾ããçºãã¦ããã¨ããããã£ãã®ã§ãããã«ããã²ææ¦ãã¦ã¿ããã¨æã£ãã
ã§ããã®ãããã® p-r ã¯âãã¡ãã
çµè«ã¨ãã¦ã¯ gox
ghr
ã使ãã°ä¸ç¬ã§åºæ¥ã¦ãã¾ããã ãã©ãä»åã¯ã¾ããããããã£ãã¨ããã ãã§ãè¯ãã¨ãããè¯ãã¨ããããã ããããã®ææ°çã使ãã«ã¯ Go ã®ãã¼ã¸ã§ã³ã 1.7
ã§ããå¿
è¦ããããããã£ãã®ã ãã©ãCircleCI ã®ã³ã³ããã¯ã¾ã ããã«è¿½éã§ãã¦ããªãããããæ°ãã Go ãèªåã§ã»ããã¢ãããã¦ããå¿
è¦ã¯ãã£ãã
ãªãªã¼ã¹èªä½ã¯ãå°ã試è¡é¯èª¤ããã®ã ãã©ããtag ãæã£ã¦ push ããã¿ã¤ãã³ã°ã§è¡ãªãããã¨ãããã¨ã«ãã¦ã¿ãã
ææ³ã¨ãä»å¾
ã¦ãªããã§ããããããªã¨æã£ããã¨ã¯ä¸éãã§ããããæãã¤ãéãã®ãµãã³ãã³ãã®å®è£
ããããã£ãã®ã§ããã£ããã®ã¾ã¨ãã¨ãã¦ãã®ã¨ã³ããªãæ¸ãã¦ãããa-know
ã®ãªãã¸ããªæ¬ä½ã¯ä»¥ä¸ã
ããã¾ã§åèªèº«ã«é¢ãããã¼ã«ã ãã©ã go get
ããã°èª°ã§ã使ããã¯ãããï½
ä»åã®åãçµã¿ã«ãã£ã¦ãã¨ã¦ãæµ ãã¯ãããã©ãä»ã¾ã§ããããã£ã¦ãªãã¦å¼ãç®ã«æãã¦ããããªã¨ãããããã£ã¦ããããã£ãæ°æã¡ãå°ãããããã ã®ã§ãããã¯ããã£ããªã¨æã£ã¦ããã
ä»å¾ã a-know
㯠Go åãã®ããããªãã¨ã試ãããã®è¯ããç å ´ãã¨ãã¦ä»ãåã£ã¦ãããããç´è¿ã§ã¯ãããå°ãè¤éãªãã¨ãè¡ãããããªãµãã³ãã³ãï¼ä¾ãã°ã³ãã³ãã©ã¤ã³ãããã¤ã¼ããããã¨ã...ï¼ãã¡ãã£ã¨ãã¤ã§ãããããæ¡å
ãã¦ãããããªã¨æã£ã¦ããã
ãã ãç¾æç¹ã§ã xargs
ã¨çµã¿åããããå°å³ã«ä¾¿å©ã§ï¼ä¾ãã° $ a-know twitter --url | xargs open
ã¨ãã£ã¦ããã¨ãã©ã¦ã¶ã§èªåã® Twitter ã¢ã«ã¦ã³ããã¼ã¸ãä¸çºã§éããï¼ãããã¯äºåã«æ³å®ãã¦ãªãã¦ãªããã¦ã±ãã
èªåã®ããã ãã®CLIãã¼ã«ãã¿ãªãããä½ã£ã¦ã¿ãã¨é¢ç½ãããï¼