<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Go - Tag - Dimas Maulana</title>
    <link>https://dimasmaulana.pages.dev/tags/go/</link>
    <description>Dimas Maulana Website</description>
    <generator>Hugo 0.150.0 &amp; FixIt v0.4.3-20260130042349-e23a50d7</generator>
    <language>en</language>
    <lastBuildDate>Sat, 03 Jun 2023 19:36:56 +0700</lastBuildDate>
    <atom:link href="https://dimasmaulana.pages.dev/tags/go/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Choosing the Right Language for Asynchronous Web APIs</title>
      <link>https://dimasmaulana.pages.dev/posts/development/choosing-the-right-language-for-asynchronous-web-apis/</link>
      <pubDate>Sat, 03 Jun 2023 19:36:56 +0700</pubDate>
      <guid>https://dimasmaulana.pages.dev/posts/development/choosing-the-right-language-for-asynchronous-web-apis/</guid>
      <category domain="https://dimasmaulana.pages.dev/categories/development/">Development</category>
      <description>&lt;p&gt;Building powerful and inexpensive web APIs requires careful consideration of the programming language you use. This article compares various programming languages ​​for their suitability for handling asynchronous operations, scalability, and resource utilization. We dive deep into the strengths and limitations of languages ​​such as Node.js, Go, Java, Python, Ruby, and PHP to help you make informed decisions when choosing the right language for your project.&lt;/p&gt;&#xA;&lt;h2 class=&#34;heading-element&#34; id=&#34;nodejs&#34;&gt;&lt;span&gt;Node.js&lt;/span&gt;&#xA;  &lt;a href=&#34;#nodejs&#34; class=&#34;heading-mark&#34;&gt;&#xA;    &lt;svg class=&#34;octicon octicon-link&#34; viewBox=&#34;0 0 16 16&#34; version=&#34;1.1&#34; width=&#34;16&#34; height=&#34;16&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&lt;p&gt;Event-driven asynchronous programming&#xA;Node.js is known for its asynchronous, event-driven programming model. It excels at handling concurrent requests by using a single thread and non-blocking I/O operations. However, due to its single-threaded nature, it may not be ideal for heavy CPU-based tasks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Executing an Embedded Bash Script in Go with Interactive Input</title>
      <link>https://dimasmaulana.pages.dev/posts/development/executing-an-embedded-bash-script-in-go-with-interactive-input/</link>
      <pubDate>Fri, 26 May 2023 07:52:00 +0700</pubDate>
      <guid>https://dimasmaulana.pages.dev/posts/development/executing-an-embedded-bash-script-in-go-with-interactive-input/</guid>
      <category domain="https://dimasmaulana.pages.dev/categories/development/">Development</category>
      <description>&lt;p&gt;This article will delve further into the code and explain how to enable interactive input when executing the embedded Bash script. We&amp;rsquo;ll walk through the code and understand how to connect the Go program&amp;rsquo;s standard input to the command&amp;rsquo;s standard input, allowing interaction with the Bash script.&lt;/p&gt;&#xA;&lt;h2 class=&#34;heading-element&#34; id=&#34;1-overview-of-the-code&#34;&gt;&lt;span&gt;1. Overview of the Code&lt;/span&gt;&#xA;  &lt;a href=&#34;#1-overview-of-the-code&#34; class=&#34;heading-mark&#34;&gt;&#xA;    &lt;svg class=&#34;octicon octicon-link&#34; viewBox=&#34;0 0 16 16&#34; version=&#34;1.1&#34; width=&#34;16&#34; height=&#34;16&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&lt;p&gt;The provided code is a Go program that executes an embedded Bash script. It imports necessary packages such as &lt;code&gt;fmt&lt;/code&gt;, &lt;code&gt;log&lt;/code&gt;, &lt;code&gt;os&lt;/code&gt;, and &lt;code&gt;os/exec&lt;/code&gt; to handle command execution, input/output, and error handling.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Running an Embedded Bash Script with Command-Line Arguments in Go</title>
      <link>https://dimasmaulana.pages.dev/posts/development/running-an-embedded-bash-script-with-command-line-arguments-in-go/</link>
      <pubDate>Thu, 25 May 2023 22:07:00 +0700</pubDate>
      <guid>https://dimasmaulana.pages.dev/posts/development/running-an-embedded-bash-script-with-command-line-arguments-in-go/</guid>
      <category domain="https://dimasmaulana.pages.dev/categories/development/">Development</category>
      <description>&lt;p&gt;In this article, we will explore how to embed a Bash script within a Go program and execute it while passing command-line arguments to the embedded script. This approach allows us to package the script directly within the Go binary, eliminating the need for an external script file. We will leverage the os/exec package and the Go embed feature to achieve this.&lt;/p&gt;&#xA;&lt;h2 class=&#34;heading-element&#34; id=&#34;prerequisites&#34;&gt;&lt;span&gt;Prerequisites&lt;/span&gt;&#xA;  &lt;a href=&#34;#prerequisites&#34; class=&#34;heading-mark&#34;&gt;&#xA;    &lt;svg class=&#34;octicon octicon-link&#34; viewBox=&#34;0 0 16 16&#34; version=&#34;1.1&#34; width=&#34;16&#34; height=&#34;16&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;Basic understanding of Go programming language&lt;/li&gt;&#xA;&lt;li&gt;Familiarity with executing shell scripts&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 class=&#34;heading-element&#34; id=&#34;step-1-embedding-the-bash-script&#34;&gt;&lt;span&gt;Step 1: Embedding the Bash Script&lt;/span&gt;&#xA;  &lt;a href=&#34;#step-1-embedding-the-bash-script&#34; class=&#34;heading-mark&#34;&gt;&#xA;    &lt;svg class=&#34;octicon octicon-link&#34; viewBox=&#34;0 0 16 16&#34; version=&#34;1.1&#34; width=&#34;16&#34; height=&#34;16&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&lt;p&gt;To embed the Bash script in the Go program, we can use the Go embed feature. Place the Bash script file, named &lt;code&gt;bash.sh&lt;/code&gt; in this example, alongside the Go source file. Annotate the script content using the &lt;code&gt;//go:embed&lt;/code&gt; directive to indicate that it should be embedded in the binary:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
