{"id":634,"date":"2020-08-25T14:06:17","date_gmt":"2020-08-25T06:06:17","guid":{"rendered":"https:\/\/www.kiccleaf.com\/?p=634"},"modified":"2020-08-27T17:18:09","modified_gmt":"2020-08-27T09:18:09","slug":"centos8%e4%b8%8b%e5%ae%89%e8%a3%85go%e7%8e%af%e5%a2%83%e5%ae%89%e8%a3%85","status":"publish","type":"post","link":"http:\/\/www.kiccleaf.com\/?p=634","title":{"rendered":"CentOS8\u4e0b\u5b89\u88c5Go\u73af\u5883\u5b89\u88c5"},"content":{"rendered":"\n<p>Go \u8bed\u8a00\u652f\u6301\u4ee5\u4e0b\u7cfb\u7edf\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Linux<\/li><li>FreeBSD<\/li><li>Mac OS X\uff08\u4e5f\u79f0\u4e3a Darwin\uff09<\/li><li>Window<\/li><\/ul>\n\n\n\n<p>\u5148\u6253\u5f00\u7f51\u5740\uff1a<a href=\"https:\/\/golang.google.cn\/dl\/\">https:\/\/golang.google.cn\/dl\/<\/a>  \u4e0b\u8f7d\u9700\u8981\u7684\u7248\u672c\uff0cWin\uff0cMac\uff0cLinux\u81ea\u884c\u9009\u62e9\u81ea\u5df1\u7684\u73af\u5883 \uff0c\u8fd9\u91cc\u53ea\u4ecb\u7ecdLinux\u73af\u5883\u7684\u914d\u7f6e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@kiccleaf ~]# wget https:\/\/golang.google.cn\/dl\/go1.15.linux-amd64.tar.gz\n[root@kiccleaf ~]# tar zxvf go1.15.linux-amd64.tar.gz\n[root@kiccleaf ~]# mv go \/usr\/local\/\n[root@kiccleaf ~]# vim \/etc\/profile\n\u5728\u6587\u4ef6\u5e95\u90e8\u589e\u52a0\uff1a\nexport GOROOT=\/usr\/local\/go\nexport PATH=$PATH:$GOROOT\/bin\n\u4fdd\u5b58\u9000\u51fa\u540e\n[root@kiccleaf ~]# source \/etc\/profile\n[root@kiccleaf ~]# go version\ngo version go1.15 linux\/amd64\n\u663e\u793ago\u73af\u5883\u5b89\u88c5\u6210\u529f\uff0c\u662f\u4e0d\u662f\u6709\u70b9\u592a\u7b80\u5355\u4e86\uff1f\n\u6765\u5427\uff0c\u7b2c\u4e00\u4e2ago\u7a0b\u5e8f\n[root@kiccleaf ~]# vim helloword.go\n<\/code><\/pre>\n\n\n\n<p>helloword.go\u5185\u5bb9:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"go\" class=\"language-go\">package main\r\nimport \"fmt\"\r\nfunc main(){\r\n   fmt.Printf(\"Hello Word!\\n\");\r\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">[root@kiccleaf ~]# go build helloword.go \r\n[root@kiccleaf ~]# .\/helloword \r\nHello Word!\r\n[root@kiccleaf ~]# du -sh helloword\r\n2.0M\thelloword\r\n\u7f16\u8bd1\u597d\u7684\u6587\u4ef6\u8fd8\u662f\u6709\u70b9\u5927\u7684\uff0c\u7b80\u5355\u7684\u4e00\u4e2aHello Word!\u9700\u89812M\u7684\u5927\u5c0f\u3002<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Go \u8bed\u8a00\u652f\u6301\u4ee5\u4e0b\u7cfb\u7edf\uff1a Linux FreeBS&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"http:\/\/www.kiccleaf.com\/?p=634\">Continue reading<span class=\"screen-reader-text\">CentOS8\u4e0b\u5b89\u88c5Go\u73af\u5883\u5b89\u88c5<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3,"footnotes":""},"categories":[4],"tags":[116,117,118],"class_list":["post-634","post","type-post","status-publish","format-standard","hentry","category-linux-","tag-centos8","tag-go","tag-118","entry"],"views":2998,"_links":{"self":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=634"}],"version-history":[{"count":4,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/634\/revisions"}],"predecessor-version":[{"id":713,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=\/wp\/v2\/posts\/634\/revisions\/713"}],"wp:attachment":[{"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=634"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kiccleaf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}