{"componentChunkName":"component---src-templates-post-template-js","path":"/posts/2019-08-22-GO_install/","webpackCompilationHash":"f084a54ccd61922cab08","result":{"data":{"markdownRemark":{"id":"f88dd9a7-2303-550a-b507-4ff4bcbd56a1","html":"<h2 id=\"linux-macos-and-freebsd-tarballs\"><a href=\"#linux-macos-and-freebsd-tarballs\" aria-label=\"linux macos and freebsd tarballs permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Linux, macOS, and FreeBSD tarballs</h2>\n<h2 id=\"download-the-archive-and-extract-it-into-usrlocal-creating-a-go-tree-in-usrlocalgo-for-example\"><a href=\"#download-the-archive-and-extract-it-into-usrlocal-creating-a-go-tree-in-usrlocalgo-for-example\" aria-label=\"download the archive and extract it into usrlocal creating a go tree in usrlocalgo for example permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example</h2>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token function\">tar</span> -C /usr/local -xzf go<span class=\"token variable\">$VERSION</span><span class=\"token builtin class-name\">.</span><span class=\"token variable\">$OS</span>-<span class=\"token variable\">$ARCH</span>.tar.gz</code></pre></div>\n<p>Choose the <a href=\"https://golang.org/dl/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">archive file</a> appropriate for your installation. For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux, the archive you want is called go1.2.1.linux-amd64.tar.gz.</p>\n<p>(Typically these commands must be run as root or through sudo.)</p>\n<p>Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:</p>\n<div class=\"gatsby-highlight\" data-language=\"bash\"><pre class=\"language-bash\"><code class=\"language-bash\"><span class=\"token builtin class-name\">export</span> <span class=\"token assign-left variable\"><span class=\"token environment constant\">PATH</span></span><span class=\"token operator\">=</span><span class=\"token environment constant\">$PATH</span>:/usr/local/go/bin</code></pre></div>\n<p><strong>Note:</strong> changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile.</p>","fields":{"slug":"/posts/2019-08-22-GO_install/","tagSlugs":["/tag/go/","/tag/linux/"]},"frontmatter":{"date":"2019-08-22","description":null,"tags":["go","linux"],"title":"Go lang Getting Started","socialImage":null}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"slug":"/posts/2019-08-22-GO_install/"}}}