{"id":44478,"date":"2022-07-23T12:21:10","date_gmt":"2023-06-26T05:03:44","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/"},"modified":"2024-01-15T12:05:45","modified_gmt":"2024-01-15T04:05:45","slug":"go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/","title":{"rendered":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e"},"content":{"rendered":"<h1>Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1<\/h1>\n<h2>Linux (Ubuntu 14.04) \u8f6c\u6362\u4e3a Windows\u3002<\/h2>\n<h3>\u8fdb\u884c\u51c6\u5907\uff08\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5Golang\uff09\u3002<\/h3>\n<p>\u7531\u4e8eGolang\u4f7f\u7528mercurial\u8fdb\u884c\u7248\u672c\u7ba1\u7406\uff0c\u56e0\u6b64\u9700\u8981\u5b89\u88c5\u7248\u672c\u63a7\u5236\u5de5\u5177\uff08\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff09\uff1asudo apt-get install mercurial\u3002<\/p>\n<p>\/\/ \u8bbe\u7f6e\u8def\u5f84\uff08\u672c\u6b21\u4f7f\u7528\u8fd9\u4e9b\uff09<br \/>\nGOROOT=$HOME\/go<br \/>\nGOBIN=$GOROOT\/bin<br \/>\nPATH=$PATH:$GOBIN<\/p>\n<p>\/\/ \u4e3a\u4e86\u7b80\u5316\u8d77\u89c1\uff0c\u6211\u4eec\u4ec5\u63d0\u4f9b\u4e00\u79cd\u7ffb\u8bd1\u65b9\u6848\uff1a<br \/>\n\/\/ \u8bbe\u7f6e\u8def\u5f84\uff08\u6b64\u5904\u4e3a\u4f8b\uff09<br \/>\nGOROOT=$HOME\/go<br \/>\nGOBIN=$GOROOT\/bin<br \/>\nPATH=$PATH:$GOBIN<\/p>\n<p>\u8bf7\u4f7f\u7528 hg clone -r release https:\/\/go\/googlecode.com\/hg\/ $GOROOT \u547d\u4ee4\u4e0b\u8f7d\u6e90\u4ee3\u7801\u3002<\/p>\n<h3>\u6784\u5efaGolang\u73af\u5883<\/h3>\n<p>\u8fdb\u5165 $GOROOT\/src \u76ee\u5f55<br \/>\n\u6267\u884c .\/all.bash<\/p>\n<h3>\u751f\u6210\u6267\u884c\u6587\u4ef6<\/h3>\n<p>\u8bbe\u7f6e\u64cd\u4f5c\u7cfb\u7edf\u4e3aWindows\uff0c\u67b6\u6784\u4e3aamd64\uff0c\u7f16\u8bd1test.go\u6587\u4ef6\u3002<\/p>\n<h3>\u8bf7\u7559\u5fc3\u8fd9\u4e9b\u8981\u70b9<\/h3>\n<p>\u53ef\u4ee5\u4f7f\u7528[apt-get install golang]\u6216\u8005[apt-get install gccgo-go]\u6765\u8fdb\u884c\u5b89\u88c5\u3002<br \/>\n\u7136\u800c\uff0c\u5982\u679c\u53ea\u662f\u8fd9\u6837\u5b89\u88c5\uff0c\u90a3\u4e48\u5728\u521b\u5efa\u548c\u8fd0\u884cWindows\u53ef\u6267\u884c\u6587\u4ef6\u65f6\u4f1a\u51fa\u73b0\u9519\u8bef\uff0c\u65e0\u6cd5\u6b63\u5e38\u751f\u6210\u3002<br \/>\n\u5c1d\u8bd5\u6784\u5efa\u7528\u4e8eWindows\u7684\u73af\u5883\u4e5f\u53ef\u80fd\u56e0\u4e3a\u7f3a\u5c11\u90e8\u5206\u6e90\u4ee3\u7801\u800c\u65e0\u6cd5\u5b8c\u6210\uff0c\u56e0\u6b64\u6700\u7a33\u59a5\u7684\u65b9\u6cd5\u662f\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5\u3002<\/p>\n<h2>Windows -&gt; Linux (Ubuntu 14.04)<br \/>\nWindows\u64cd\u4f5c\u7cfb\u7edf -&gt; Linux (Ubuntu14.04)<\/h2>\n<p>\u8bbe\u7f6e\u4e34\u65f6\u73af\u5883\u53d8\u91cf\u5e76\u6784\u5efa\uff1a<\/p>\n<p>export GOOS=linux<br \/>\nexport GOARCH=amd64<br \/>\ngo build test.go<\/p>\n<p>\u51fa\u73b0\u9519\u8bef\uff0c\u65e0\u6cd5\u8fdb\u884c\u6784\u5efa\uff1a\u5fc5\u987b\u4f7f\u7528make.bat\u6765\u8fdb\u884clinux\/amd64\u7684\u5f15\u5bfc\u7a0b\u5e8f\u6784\u5efa\u3002<\/p>\n<h3>\u4e8b\u5148\u6e96\u5099<\/h3>\n<p>\u521b\u5efa\u7528\u4e8e\u5176\u4ed6\u5e73\u53f0\u7684\u6784\u5efa\u8bbe\u7f6e<br \/>\n\u5b89\u88c5Mingw<br \/>\n\uff08\u5c06Mingw\u7684bin\u6587\u4ef6\u5939\u8bbe\u7f6e\u5230\u73af\u5883\u53d8\u91cfPATH\u4e2d\uff09<br \/>\ncd [Golang\u5b89\u88c5\u6587\u4ef6\u5939]\\src<br \/>\n\u8bbe\u7f6eGOOS\u4e3alinux<br \/>\n\u8bbe\u7f6eGOARCH\u4e3aamd64<br \/>\n\u8fdb\u884c\u7f16\u8bd1<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e2a\uff0c\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u9002\u7528\u4e8elinux\/amd64\u7684\u6784\u5efa\u73af\u5883\u3002<\/p>\n<h3>\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6<\/h3>\n<p>\u8bbe\u7f6e GOOS=linux\uff0c\u8bbe\u7f6e GOARCH=amd64\uff0c\u7f16\u8bd1 test.go\u3002<\/p>\n<p>\u53ef\u4ee5\u5199\u4e0b\u6765\u3002\u53ef\u4ee5\u6267\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1 Linux (Ubuntu 14.04) \u8f6c\u6362\u4e3a Windows\u3002 \u8fdb\u884c\u51c6\u5907\uff08\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-44478","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\" \/>\n<meta property=\"og:description\" content=\"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1 Linux (Ubuntu 14.04) \u8f6c\u6362\u4e3a Windows\u3002 \u8fdb\u884c\u51c6\u5907\uff08\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-26T05:03:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T04:05:45+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/\",\"name\":\"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-06-26T05:03:44+00:00\",\"dateModified\":\"2024-01-15T04:05:45+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\/","og_locale":"zh_CN","og_type":"article","og_title":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e","og_description":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1 Linux (Ubuntu 14.04) \u8f6c\u6362\u4e3a Windows\u3002 \u8fdb\u884c\u51c6\u5907\uff08\u4ece\u6e90\u4ee3\u7801\u5b89\u88c5 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-06-26T05:03:44+00:00","article_modified_time":"2024-01-15T04:05:45+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/","name":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-06-26T05:03:44+00:00","dateModified":"2024-01-15T04:05:45+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Go\u8bed\u8a00\u7684\u4ea4\u53c9\u7f16\u8bd1\u548c\u73af\u5883\u914d\u7f6e"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/go%e8%af%ad%e8%a8%80%e7%9a%84%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91%e5%92%8c%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=44478"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44478\/revisions"}],"predecessor-version":[{"id":59316,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44478\/revisions\/59316"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=44478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=44478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=44478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}