-
Notifications
You must be signed in to change notification settings - Fork 0
/
golang.html
350 lines (240 loc) · 13 KB
/
golang.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Golang in Review</title>
<link rel="stylesheet" href="/assets/css/main.css" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/assets/css/prism.css">
<script async src="/assets/js/prism.js"></script>
<link rel="stylesheet" href="/assets/css/ideal-image-slider.css">
<link rel="stylesheet" href="/assets/css/video-embed.css">
<script async src="/assets/js/ideal-image-slider.js"></script>
<link href="https://fonts.googleapis.com/css?family=Fira+Sans&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,400i,700" rel="stylesheet">
<link rel="shortcut icon" href="/assets/images/alchemy.ico">
<link rel="alternate" type="application/rss+xml" title="RSS Feed for archiavelli" href="/feed.xml" />
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>Golang in Review | archiavelli</title>
<meta name="generator" content="Jekyll v3.9.2" />
<meta property="og:title" content="Golang in Review" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Bahasa pemrograman yang sedang naik daun, sangat powerful dan akan tersedia dimana-mana. Para programmernya sedang banyak dicari, sehingga" />
<meta property="og:description" content="Bahasa pemrograman yang sedang naik daun, sangat powerful dan akan tersedia dimana-mana. Para programmernya sedang banyak dicari, sehingga" />
<link rel="canonical" href="https://www.harapan.me/golang" />
<meta property="og:url" content="https://www.harapan.me/golang" />
<meta property="og:site_name" content="archiavelli" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-02-27T00:00:00+07:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Golang in Review" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2020-02-27T00:00:00+07:00","datePublished":"2020-02-27T00:00:00+07:00","description":"Bahasa pemrograman yang sedang naik daun, sangat powerful dan akan tersedia dimana-mana. Para programmernya sedang banyak dicari, sehingga","headline":"Golang in Review","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.harapan.me/golang"},"url":"https://www.harapan.me/golang"}</script>
<!-- End Jekyll SEO tag -->
<!-- Google Analytics -->
<script>
var host = window.location.hostname;
if(host != "localhost")
{
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-134611589-1', 'auto');
ga('send', 'pageview');
}
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-4188943909307860",
enable_page_level_ads: true
});
</script>
</head>
<body>
<div class="content-container">
<header class="header">
<div class="header-small">
<a href="https://www.harapan.me">archiavelli</a>
</div>
<nav class="header-nav-small">
<a href="/">home</a>
<a href="/about">about</a>
<a href="/exlibris">exlibris</a>
<a href="/thesummits">summits</a>
<a href="/blog">blog</a>
</nav>
</header>
<!-- <div class="post-paging">
<div class="left">
<a href="/blog/datawarehouse-in-review/">
<i class="fa fa-angle-left fa-2x" style="color:#343a40"></i>
</a>
</div>
<div class="right">
<a href="/norwegianwoodv2">
<i class="fa fa-angle-right fa-2x" style="color:#343a40"></i>
</a>
</div>
</div>
-->
<div class="post">
<div class="post-title">Golang in Review</div>
<span class="post-date">
in-review ~ <time>27 Feb 2020</time>
</span>
<div class="post-tag">
<ul>
<li>
<a href="https://www.harapan.me/blog/label#technology">
<span>technology</span>
</a>
</li>
<li>
<a href="https://www.harapan.me/blog/label#programmming">
<span>programmming</span>
</a>
</li>
<li>
<a href="https://www.harapan.me/blog/label#go">
<span>go</span>
</a>
</li>
<li>
<a href="https://www.harapan.me/blog/label#in-review">
<span>in-review</span>
</a>
</li>
</ul>
</div>
<br />
<div class="line-numbers">
<p>Pertengahan 2019 menjadi project pertama, sekaligus pertama kali aku belajar Golang. Bahasa yang cukup menarik karena syntax-nya sedikit banyak mirip dengan C++. Dan harusnya learning curve untuk mempelajari bahasa ini tidaklah begitu tinggi. Selain itu Golang menawarkan kecepatan dan high perfomance by default, hmm cukup menarik digunakan, mengingat kebutuhan untuk membangung sistem processing yang cepat. Selanjutnya Golang untuk beberapa saat ini sangat populer dimana banyak perusahaan menggunakan Golang sebagai dalam sistem mereka. Project tersebut hanya penambahan fitur kecil sehingga tidak cukup mendalam Golang ku gunakan. Kemudian diawal tahun ini ada rencana untuk sebuah project baru yang akan menggunakan Golang sebagai bahasa pemrogrammnya. Mungkin kali ini adalah kesempatanku untuk belajar lebih mendalam lagi bahasa ini.</p>
<p>Karena belajar untuk kedua kalinya ini, aku kepikiran untuk mencatat dan mendokumentasinyakan. Setidaknya sebelum mahir-mahir banget aku dapat melihat kembali catatan ini ketika lupa syntax dan konsep-konsep esensial lainya.</p>
<ul id="markdown-toc">
<li><a href="#sintaks-dasar" id="markdown-toc-sintaks-dasar">Sintaks Dasar</a> <ul>
<li><a href="#hello-world" id="markdown-toc-hello-world">Hello World</a></li>
<li><a href="#variable" id="markdown-toc-variable">Variable</a></li>
<li><a href="#if-statement" id="markdown-toc-if-statement">If Statement</a></li>
<li><a href="#loop-statement" id="markdown-toc-loop-statement">Loop statement</a></li>
</ul>
</li>
<li><a href="#rekomendasi-bahan-bacaan-dan-belajar-lebih-lanjut" id="markdown-toc-rekomendasi-bahan-bacaan-dan-belajar-lebih-lanjut">Rekomendasi bahan bacaan dan belajar lebih lanjut</a></li>
</ul>
<h3 id="sintaks-dasar">Sintaks Dasar</h3>
<h4 id="hello-world">Hello World</h4>
<div class="language-go highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">package</span> <span class="n">main</span>
<span class="k">import</span> <span class="p">(</span>
<span class="s">"fmt"</span>
<span class="p">)</span>
<span class="k">func</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">fmt</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Hello World"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>
<h4 id="variable">Variable</h4>
<div class="language-go highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">package</span> <span class="n">main</span>
<span class="k">import</span> <span class="p">(</span>
<span class="s">"fmt"</span>
<span class="p">)</span>
<span class="k">func</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">fmt</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Hello World"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>
<h4 id="if-statement">If Statement</h4>
<div class="language-go highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">package</span> <span class="n">main</span>
<span class="k">import</span> <span class="p">(</span>
<span class="s">"fmt"</span>
<span class="p">)</span>
<span class="k">func</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">fmt</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Hello World"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>
<h4 id="loop-statement">Loop statement</h4>
<div class="language-go highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">package</span> <span class="n">main</span>
<span class="k">import</span> <span class="p">(</span>
<span class="s">"fmt"</span>
<span class="p">)</span>
<span class="k">func</span> <span class="n">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">fmt</span><span class="o">.</span><span class="n">Println</span><span class="p">(</span><span class="s">"Hello World"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre></div></div>
<p><br />
<br /></p>
<hr />
<h3 id="rekomendasi-bahan-bacaan-dan-belajar-lebih-lanjut">Rekomendasi bahan bacaan dan belajar lebih lanjut</h3>
<ul>
<li><a href="https://github.com/quii/learn-go-with-tests">Github, learn-go-with test</a>, menganut prinsip learning by doing, repository ini menjadi alternatif yang bagus untuk belajar golang dengan cukup cepat. Saya sangat menyukai pendekatannya.</li>
<li><a href="https://www.amazon.com/Head-First-Go-Jay-McGavren/dp/1491969555">Head First Go</a>, jika saya pertama kali belajar pemrograman, buku ini akan menjadi pilihan utama saya. Namun tidak untuk programmer yang sudah berpengalaman.</li>
</ul>
</div>
<br />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-4188943909307860"
data-ad-slot="8423988260"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- include relatedposts.html Belum selesai Design -->
<!-- Disqus -->
<div class="post-disqus">
<section id="disqus_thread"></section>
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://harapanme.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- harapan.me-TextAds -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4188943909307860"
data-ad-slot="5493028008"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="post-up" align="center">
<a href="#">
<i class="fa fa-angle-up fa-2x" style="color:#343a40"></i>
</a>
</div>
</div>
<!-- Documents about icons are here: http://fontawesome.io/icons/ -->
<div class="footer">
<hr />
<div class="footer-link">
<a href="https://twitter.com/archiavelli"><i class="fa fa-twitter" aria-hidden="true"></i></a>
<a href="https://github.com/rhps"><i class="fa fa-github" aria-hidden="true"></i></a>
<a href="http://stackoverflow.com/users/5575744"><i class="fa fa-stack-overflow" aria-hidden="true"></i></a>
<a href="mailto:rio@harapan.me"><i class="fa fa-envelope" aria-hidden="true"></i></a>
</div>
<i class="fa fa-copyright" aria-hidden="true"></i> 2018 harapan.me. Made with <i class="fa fa-heart pink"></i> with many cups of <i class="fa fa-coffee" aria-hidden="true"></i>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.10.0/css/lightbox.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.10.0/js/lightbox-plus-jquery.min.js"></script>
</body>
</html>