×ðÁú¿­Ê±¹ÙÍøµÇ¼

sublimeÔõôװÖÃgolang

sublimeÊÇÒ»¿îÇáÁ¿¼¶µÄÎı¾±à¼­Æ÷£¬¾ßÓÐÇ¿Ê¢µÄ²å¼þϵͳ£¬¿ÉÒÔÖª×ãÖÖÖÖ±à³ÌÓïÑԵĿª·¢ÐèÇó¡£

GolangÊÇÒ»ÖÖÐÂÐ˵ĸßÐÔÄܱà³ÌÓïÑÔ£¬ÒѾ­³ÉΪÔÆÅÌËãºÍ´óÊý¾ÝÁìÓòµÄÖ÷Á÷ÓïÑÔÖ®Ò»¡£

ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÏÈÈÝÔõÑùÔÚSublimeÖÐ×°ÖÃGolang£¬Àû±ãÄú¾ÙÐпª·¢Êµ¼ù¡£

Ò»¡¢×°ÖÃSublime

Ê×ÏÈ£¬ÔÚSublime¹ÙÍøÉÏÏÂÔØÊʺÏÄãµÄ²Ù×÷ϵͳ°æ±¾µÄ×°Öðü£¬È»ºóƾ֤ÌáÐѾÙÐÐ×°Öü´¿É¡£

Á¬Ã¦Ñ§Ï°¡°goÓïÑÔÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

¶þ¡¢×°ÖÃGoÓïÑÔ°ü

×°ÖÃGoÓïÑÔ°üÓÐÒÔÏÂÁ½¸ö°ì·¨£º

1.ÏÂÔØGoÓïÑÔ¿ª·¢°ü

ÔÚGolang¹ÙÍøÖУ¬ÏÂÔØÊʺÏÄãµÄ²Ù×÷ϵͳ°æ±¾µÄ¿ª·¢°ü£¬ÏÂÔØÍê³Éºó¾Í¿ÉÒÔƾ֤²Ù×÷ϵͳµÄ×°Ö÷½·¨¾ÙÐÐ×°Öá£

2.ÉèÖÃÇéÐαäÁ¿

ÉèÖÃÇéÐαäÁ¿¿ÉÒÔÈõçÄÔÕÒµ½GoÓïÑÔµÄ×°ÖÃĿ¼£¬½ø¶øʹÓÃGoÓïÑÔ¡£

ÔÚWindowsϵͳÖУ¬¿ÉÒÔƾ֤ÒÔÏ°취¾ÙÐУº

£¨1£©ÔÚ¿ØÖÆÃæ°åÖеã»÷¡°ÏµÍ³ºÍÇå¾²¡±£¬È»ºóµã»÷¡°ÏµÍ³¡±¡£

£¨2£©µã»÷¡°¸ß¼¶ÏµÍ³ÉèÖá±£¬È»ºóµã»÷¡°ÇéÐαäÁ¿¡±¡£

£¨3£©ÔÚ¡°ÏµÍ³±äÁ¿¡±£¨»òÕß¡°Óû§±äÁ¿¡±£©ÖУ¬ÕÒµ½¡°Path¡±±äÁ¿²¢µã»÷¡°±à¼­¡±¡£

£¨4£©ÔÚµ¯³öµÄ¡°±à¼­ÇéÐαäÁ¿¡±´°¿ÚÖУ¬½«GoÓïÑÔµÄ×°ÖÃĿ¼¼ÓÈëµ½±äÁ¿ÖµÁбíÖС£

£¨5£©ÉèÖÃÍê³Éºó£¬ÐèÒªÖØз­¿ªSublimeÈí¼þ²Å»ªÉúЧ¡£

ÔÚMacϵͳÖУ¬¿ÉÒÔƾ֤ÒÔÏ°취¾ÙÐУº

£¨1£©·­¿ªTerminal£¨Öնˣ©¡£

£¨2£©ÊäÈëÒÔÏÂÏÂÁ

echo 'export GOROOT=/usr/local/go' >> ~/.bash_profile
echo 'export GOPATH=$HOME/Go' >> ~/.bash_profile
echo 'export PATH=$PATH:$GOROOT/bin' >> ~/.bash_profile

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬/usr/local/goÌåÏÖGoÓïÑÔµÄ×°ÖÃĿ¼¡£

£¨3£©ÊäÈëÒÔÏÂÏÂÁʹÉèÖÃÉúЧ£º

source ~/.bash_profile

µÇ¼ºó¸´ÖÆ

£¨4£©ÉèÖÃÍê³Éºó£¬ÖØз­¿ªSublimeÈí¼þ¼´¿ÉÉúЧ¡£

Èý¡¢×°ÖÃSublime²å¼þ

ÔÚSublimeÖУ¬¿ÉÒÔʹÓÃGoSublimeºÍGo±àÒëÆ÷µÈ²å¼þÀ´Ö§³ÖGolangµÄ¿ª·¢¡£ÕâÀïÎÒÃÇÒÔGoSublimeΪÀý¡£

1.×°ÖÃPackage Control

Package ControlÊÇSublime×Ô´øµÄ²å¼þÖÎÀí¹¤¾ß£¬¿ÉÒÔÀû±ãµØ×°Öá¢Ð¶ÔغÍÖÎÀí²å¼þ¡£

ÔÚSublimeÖУ¬°´Ï¡°ctrl+¡±£¨»òÕß¡°cmd+¡±£©£¬·­¿ª¿ØÖÆ̨£¬È»ºóÕ³ÌùÒÔÏ´úÂë²¢»Ø³µ£º

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

µÇ¼ºó¸´ÖÆ

2.×°ÖÃGoSublime

ÔÚSublimeÖУ¬°´Ï¡°ctrl+shift+p¡±£¨»òÕß¡°cmd+shift+p¡±£©£¬·­¿ªÏÂÁîÃæ°å£¬ÊäÈë¡°install package¡±²¢»Ø³µ£¬È»ºóÊäÈë¡°GoSublime¡±²¢»Ø³µ¡£

×°ÖÃÍê³Éºó£¬Äã¾Í¿ÉÒÔÔÚSublimeÖÐʹÓÃGoÓïÑÔ¾ÙÐпª·¢ÁË¡£

ËÄ¡¢±àдHello World³ÌÐò

ÔÚÇ°ÃæµÄ°ì·¨ÖУ¬ÎÒÃÇÒѾ­Íê³ÉÁËSublimeºÍGolangµÄ×°ÖúÍÉèÖã¬ÏÖÔÚÈÃÎÒÃÇÀ´±àдһ¸ö¼òÆÓµÄHello World³ÌÐò¡£

1.½¨ÉèÐÂÎļþ

ÔÚSublimeÖУ¬°´Ï¡°ctrl+n¡±£¨»òÕß¡°cmd+n¡±£©£¬½¨ÉèÒ»¸öÐÂÎļþ¡£

2.ÊäÈë³ÌÐò´úÂë

ÊäÈëÒÔÏ´úÂ룺

package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

µÇ¼ºó¸´ÖÆ

´úÂë˵Ã÷£º

¸Ã³ÌÐòʹÓÃÁËfmt°ü£¨¼´±ê×¼¿âµÄÃûÌû¯ÊäÈëÊä³ö¿â£©£¬²¢Ê¹ÓÃÆäÖеÄPrintlnÒªÁìÊä³öÒ»ÐÐÎÄ×Ö¡°Hello, world!¡±µ½¿ØÖÆ̨¡£

3.ÉúÑÄÎļþ

ÔÚSublimeÖУ¬°´Ï¡°ctrl+s¡±£¨»òÕß¡°cmd+s¡±£©£¬ÉúÑÄÎļþ£¬²¢½«ÎļþÉúÑĵ½ÄãÉ趨ºÃµÄÊÂÇéĿ¼ÖС£

4.ÔËÐгÌÐò

·­¿ªÏÂÁîÐÐÖնˣ¬Çл»µ½³ÌÐòËùÔÚĿ¼£¬È»ºóÊäÈëÒÔÏÂÏÂÁ

go run hello.go

µÇ¼ºó¸´ÖÆ

³ÌÐò½«»áÔÚ¿ØÖÆ̨Êä³ö¡°Hello, world!¡±µÄÐÅÏ¢¡£

µ½ÕâÀÎÒÃǾÍÀֳɵØ×°Öá¢ÉèÖúÍʹÓÃÁËGolangºÍSublime¡£Ï£Íû±¾ÎĶÔÄãÓÐËù×ÊÖú£¬¸ü¶à¹ØÓÚSublimeºÍGolangµÄ½Ì³Ì£¬¾´Çë¹Ø×¢ºóÐøµÄÎÄÕ¡£

ÒÔÉϾÍÊÇsublimeÔõôװÖÃgolangµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ