<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Go on kenji.blog</title><link>http://kenji.blog/en/tags/go/</link><description>Recent content in Go on kenji.blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>kenjinote</copyright><lastBuildDate>Sat, 10 Sep 2022 00:48:17 +0900</lastBuildDate><atom:link href="http://kenji.blog/en/tags/go/index.xml" rel="self" type="application/rss+xml"/><item><title>How to Install Go</title><link>http://kenji.blog/en/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/</link><pubDate>Sat, 10 Sep 2022 00:48:17 +0900</pubDate><guid>http://kenji.blog/en/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/</guid><description>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/cover.png" alt="Featured image of post How to Install Go" />&lt;h1 id="introduction">Introduction
&lt;/h1>&lt;p>Go is a relatively new programming language released by Google in 2009.
The Go compiler, tools, and libraries are released as open source.
Also, Go is a statically typed language like C and Java, but it does not use pointers in the same way C does.&lt;/p>
&lt;h1 id="how-to-install">How to Install
&lt;/h1>&lt;p>&lt;a class="link" href="https://go.dev/dl/" target="_blank" rel="noopener"
>Install Go&lt;/a>&lt;/p>
&lt;p>Installers for each platform are available from the site above.&lt;/p>
&lt;p>Follow the instructions on the screen to proceed with the installation.
&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_hudec02a4f1dfaca9415d58a56d502b14f_18782_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_hudec02a4f1dfaca9415d58a56d502b14f_18782_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_1.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_1_hu803f0fb268a2cf0fa74e4e36a5b3a765_20314_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_1_hu803f0fb268a2cf0fa74e4e36a5b3a765_20314_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_1.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_2.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_2_hu05fb3923212918b7539badd0200ea75c_11067_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_2_hu05fb3923212918b7539badd0200ea75c_11067_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_2.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_3.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_3_hu316d63501ec24e1e74dc3cb674d4cc1f_11612_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_3_hu316d63501ec24e1e74dc3cb674d4cc1f_11612_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_3.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_5.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_5_hu8bb188f8700bed3c70acaed6e511012d_14167_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_5_hu8bb188f8700bed3c70acaed6e511012d_14167_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_5.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_6.png"
width="495"
height="387"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_6_hu0a1b7e9cf2cb725ed5a7ea7685880608_16796_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_6_hu0a1b7e9cf2cb725ed5a7ea7685880608_16796_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_6.png"
class="gallery-image"
data-flex-grow="127"
data-flex-basis="306px"
>&lt;/p>
&lt;p>Installation is complete. It&amp;rsquo;s easy, isn&amp;rsquo;t it?&lt;/p>
&lt;h1 id="first-program">First Program
&lt;/h1>&lt;p>Save the following program as &lt;code>hello.go&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-go" data-lang="go">&lt;span class="line">&lt;span class="cl">&lt;span class="kn">package&lt;/span> &lt;span class="nx">main&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kn">import&lt;/span> &lt;span class="s">&amp;#34;fmt&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kd">func&lt;/span> &lt;span class="nf">main&lt;/span>&lt;span class="p">()&lt;/span> &lt;span class="p">{&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">fmt&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nf">Printf&lt;/span>&lt;span class="p">(&lt;/span>&lt;span class="s">&amp;#34;Hello World\n&amp;#34;&lt;/span>&lt;span class="p">)&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">}&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>If you execute &lt;code>go run hello.go&lt;/code> from the command prompt or terminal, &lt;code>Hello, world!&lt;/code> will be output.&lt;/p>
&lt;p>If you want to compile, executing &lt;code>go build hello.go&lt;/code> will generate &lt;code>hello.exe&lt;/code>.
Executing &lt;code>hello.exe&lt;/code> will output &lt;code>Hello, world!&lt;/code>.&lt;/p>
&lt;h1 id="you-can-also-execute-code-on-a-web-page">You can also execute code on a web page
&lt;/h1>&lt;p>&lt;a class="link" href="https://go.dev/play/" target="_blank" rel="noopener"
>https://go.dev/play/&lt;/a>&lt;/p>
&lt;p>&lt;img src="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_7.png"
width="793"
height="668"
srcset="http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_7_hu4549f097b6cd8fd929d9562692076ffb_15605_480x0_resize_box_3.png 480w, http://kenji.blog/p/go%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/images/img_7_hu4549f097b6cd8fd929d9562692076ffb_15605_1024x0_resize_box_3.png 1024w"
loading="lazy"
alt="img_7.png"
class="gallery-image"
data-flex-grow="118"
data-flex-basis="284px"
>&lt;/p>
&lt;h1 id="japanese-documentation">Japanese Documentation
&lt;/h1>&lt;p>&lt;a class="link" href="http://go.shibu.jp/" target="_blank" rel="noopener"
>http://go.shibu.jp/&lt;/a>&lt;/p>
&lt;p>The explanations necessary for learning Go are consolidated in the link above (Japanese translated version).
Since technologies related to Go are open, the resources are rich enough that you don&amp;rsquo;t even need to buy a physical textbook.&lt;/p>
&lt;p>Enjoy your Go life!&lt;/p></description></item></channel></rss>