{"id":78,"date":"2024-08-31T07:58:53","date_gmt":"2024-08-31T00:58:53","guid":{"rendered":"https:\/\/gotutorial.org\/?page_id=78"},"modified":"2024-08-31T07:58:55","modified_gmt":"2024-08-31T00:58:55","slug":"install-go","status":"publish","type":"page","link":"https:\/\/www.gotutorial.org\/go-tutorial\/install-go\/","title":{"rendered":"Install Go"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to install Go on your computer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Downloading Go<\/h2>\n\n\n\n<p>First, navigate to the <a href=\"https:\/\/go.dev\/doc\/install\" target=\"_blank\" rel=\"noreferrer noopener\">Go official website<\/a> <\/p>\n\n\n\n<p>Second, click the download link to download the Go installer. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Go<\/h2>\n\n\n\n<p>We&#8217;ll show you how to install Go on Windows, macOS, and Linux.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Go on Windows<\/h3>\n\n\n\n<p>First, open the MSI file to launch the Go installer.<\/p>\n\n\n\n<p>Second, follow the prompts to complete installing Go.<\/p>\n\n\n\n<p>Third, open your Command Prompt and run the following command to verify that you installed Go successfully:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">go version<\/code><\/span><\/pre>\n\n\n<p class=\"note\">Note that if you have opened the Command Prompt before, you need to restart it so that the changes are taking effect.<\/p>\n\n\n\n<p>This command will display the installed version of Go like:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">go version go1.23.0 windows\/amd64<\/code><\/span><\/pre>\n\n\n<p>Note that you are likely to see a higher version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Go on macOS<\/h3>\n\n\n\n<p>First, open the downloaded package file (<code>.pkg<\/code>). It will launch the Go installer. <\/p>\n\n\n\n<p>Second, follow the installer prompts to complete the installation. By default, the installer will install Go to the <code>\/usr\/local\/go<\/code><\/p>\n\n\n\n<p class=\"note\">Note that the installer should add <code>\/usr\/local\/go\/bin<\/code> directory to your\u00a0<code>PATH<\/code>\u00a0environment variable.<\/p>\n\n\n\n<p>Third, open your terminal and run the following command to verify that Go is installed correctly:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">go version<\/code><\/span><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Installing Go on Linux<\/h3>\n\n\n\n<p>First, open a terminal, navigate to the directory where you store the downloaded tarball file (tar.gz), and run the following command to extract the archive to <code>\/usr\/local\/go<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">rm -rf \/usr\/local\/go &amp;&amp; tar -C \/usr\/local -xzf go1.23.0.linux-amd64.tar.gz<\/code><\/span><\/pre>\n\n\n<p>Please replace the go1.23.0.linux-amd64.tar.gz file with your downloaded one.<\/p>\n\n\n\n<p>Second, add <code>\/usr\/local\/go<\/code> to the <code>PATH<\/code> environment variable:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">export<\/span> PATH=$PATH:<span class=\"hljs-regexp\">\/usr\/<\/span>local\/go\/bin<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Third, verify the Go installation by running the following command from your terminal:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">go version<\/code><\/span><\/pre>\n\n\n<p>It&#8217;ll show the installed version of Go.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<div class=\"wth-question\">Was this tutorial helpful?<\/div>\n\t<div class=\"wth-thumbs\">\n\t\t<button\n\t\t\tdata-post=\"78\"\n\t\t\tdata-post-url=\"https:\/\/www.gotutorial.org\/go-tutorial\/install-go\/\"\n\t\t\tdata-post-title=\"Install Go\"\n\t\t\tdata-response=\"1\"\n\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t><\/path>\n\t\t\t<\/svg>\n\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t<\/button>\n\n\t\t<button\n\t\t\tdata-response=\"0\"\n\t\t\tdata-post=\"78\"\n\t\t\tdata-post-url=\"https:\/\/www.gotutorial.org\/go-tutorial\/install-go\/\"\n\t\t\tdata-post-title=\"Install Go\"\n\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t>\n\t\t\t<svg\n\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstroke-width=\"2\"\n\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t>\n\t\t\t\t<path\n\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t><\/path>\n\t\t\t<\/svg>\n\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t<\/button>\n\t<\/div>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: in this tutorial, you will learn how to install Go on your computer. Downloading Go First, navigate to the Go official website Second, click the download link to download the Go installer. Installing Go We&#8217;ll show you how to install Go on Windows, macOS, and Linux. Installing Go on Windows First, open the MSI [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-78","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/pages\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":2,"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/pages\/78\/revisions"}],"predecessor-version":[{"id":80,"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/pages\/78\/revisions\/80"}],"up":[{"embeddable":true,"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/pages\/10"}],"wp:attachment":[{"href":"https:\/\/www.gotutorial.org\/wp-json\/wp\/v2\/media?parent=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}