éçºã«ããã¦ãããã°ãã§ããã¨ã¨ã©ã¼ã®ç¹å®ãããããã®ã§ã
VSCode ã«ãã㦠Go ã®ãããã°ç°å¢ã®æ§ç¯ã¡ã¢ãè¨è¼ãã¾ãã
Â
æ¤è¨¼ç¨ã³ã¼ã
Â
go run main.goÂ
åè¨ï¼ 3
Â
ãªãã§ããªãã·ã³ãã«ãªã³ã¼ãã§ãã
åå¤æ°ã«å ¥ãå¤ããããã°ã§ããããã«ãã¦ã¿ã¾ãã
æé ï¼ï¼ãããã°ãã¼ã«(go-delve)ã VSCode ã«ã¤ã³ã¹ãã¼ã«ãã
VSCode ã®ãããã°ã¡ãã¥ã¼ï¼ä¸ããï¼ã¤ç®ã®ã¢ã¤ã³ã³ï¼ãã¯ãªãã¯ãããRun and Debugããã¯ãªãã¯ãã¾ãã
Â
ããã¨ãVSCode ã®å³ä¸ã«ä¸è¨ã®ã¨ã©ã¼ã示ããã¤ã¢ãã°ãåºã¦ãã¾ãã
Â
ã©ããããgo-delve ã¨ããGoã®æ¡å¼µæ©è½ãå¿ è¦ãªãããªã®ã§ãä¸è¨ã®ã¨ã©ã¼ã®æ示ã«å¾ã£ã¦ã¤ã³ã¹ãã¼ã«ãã¾ãã
Â
æé ï¼ï¼ãããã°å®è¡
ã¤ã³ã¹ãã¼ã«ã§ããã®ã§ãåã³ãRun and Debugããã¯ãªãã¯ãã¾ãã
Â
go.mod ããªãã¨æãããã®ã§ããgo mod init {ããã¸ã§ã¯ããã©ã«ãå}ãã³ãã³ããå®è¡ã㦠go.mod ãä½æãã¦ãããå度ãRun and Debugããã¯ãªãã¯ãã¾ãã
Â
ã¨ã©ã¼ã解æ¶ãã¦ç¡äºã«èµ·åã§ãã¾ããã
Â
ç¶ãã¦ããã¬ã¼ã¯ãã¤ã³ãã§ç¹å®ã®å ´æã§å¦çãæ¢ããå¤æ°ã®å¤ã確èªãã¦ã¿ã¾ãã
ï¼ï¼è¡ç®ã®ç®æã«ãã¬ã¼ã¯ãã¤ã³ããè²¼ã£ã¦ãã¾ãã
ããã§å¦çãä¸æä¸æããå¤æ°ã®å¤ã確èªãã¦ã¿ã¾ãã
Â
Â
ãã¬ã¼ã¯ãã¤ã³ããè²¼ã£ãç¶æ ã§ããRun and Debugããã¯ãªãã¯ãã¦å®è¡ãã¾ãã
Â
ããã¨å·¦ä¸ã® VARIABLES ã¡ãã¥ã¼ã§ãã¬ã¼ã¯ãã¤ã³ãã§æ¢ããæç¹ã®åå¤æ°å¤ã確èªã§ãã¾ãã
ã¡ãªã¿ã«ãF5ãã¼ã§å¦çãåéã§ãã¾ãã
Â
以ä¸ããããã°ç°å¢ãæ§ç¯ã§ãã¾ããã
Â
ãã¾ã¾ã§ã³ãã³ãã©ã¤ã³ããã®å®è¡ã®ã¿ã§ã³ã³ã½ã¼ã«ã«åºåãããã¨ã©ã¼ãé ¼ãã«ä¿®æ£ããã¦ãã¾ãããããããã°ã§ããããã«ãªã£ãã®ã§ãã楽ã«ã¨ã©ã¼è§£æ¶ãããã°ã©ã ã®åä½ç¢ºèªãã§ãããã§ãã
Â