<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[DevLearn]]></title><description><![CDATA[DevLearn]]></description><link>https://www.hashnode.joyaldev.me</link><generator>RSS for Node</generator><lastBuildDate>Mon, 25 May 2026 08:27:12 GMT</lastBuildDate><atom:link href="https://www.hashnode.joyaldev.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Go Insights: Introduction]]></title><description><![CDATA[Introduction

In this blog, we are discussing the GO programming language, its origin, performance and so on. Let's get started 😇!!!
Go is a statically typed, compiled high-level programming language designed at Google by Robert Griesemer, Rob Pike,...]]></description><link>https://www.hashnode.joyaldev.me/go-insights-introduction</link><guid isPermaLink="true">https://www.hashnode.joyaldev.me/go-insights-introduction</guid><category><![CDATA[go introduction]]></category><category><![CDATA[go history]]></category><category><![CDATA[go opensource projects]]></category><category><![CDATA[go insights]]></category><dc:creator><![CDATA[joyal raphel]]></dc:creator><pubDate>Fri, 31 Mar 2023 04:44:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1680200433213/8d6078df-209e-4248-afbe-2513500b0e90.gif" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p><img src="https://github.com/egonelbre/gophers/raw/master/.thumb/sketch/superhero/standing.png" alt class="image--center mx-auto" /></p>
<p>In this blog, we are discussing the GO programming language, its origin, performance and so on. Let's get started <code>😇</code>!!!</p>
<p><strong>Go</strong> is a statically typed, compiled high-level programming language designed at <a target="_blank" href="http://google.com">Google</a> by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but with memory safety, garbage collection, structural typing, and CSP-style concurrency. It is often referred to as <strong>Golang</strong> because of its former domain name, <code>golang.org</code> ( currently <a target="_blank" href="http://go.dev">go.dev</a> ), but its proper name is <strong>Go</strong>.</p>
<h2 id="heading-philosophy">Philosophy</h2>
<p>Go was designed at <strong>Google</strong> in 2007 to improve programming productivity in an era of multicore, networked machines and large codebases. The designers wanted to address criticism of other languages in use at Google, but keep their useful characteristics</p>
<p>Go was publicly announced in November 2009, and version 1.0 was released in March 2012. Go is widely used in production at Google and in many other organizations and open-source projects</p>
<h2 id="heading-gopher">Gopher</h2>
<p><img src="https://github.com/egonelbre/gophers/raw/master/.thumb/vector/adventure/hiking.png" alt class="image--center mx-auto" /></p>
<p>"<strong>Gopher</strong>" is the official mascot of the Go programming language, and it has had a significant influence on the development and culture of the language. Firstly, it has helped to give the language a distinct and memorable identity. The Go team has often cited the Gopher's characteristics - including its industriousness, reliability, and adaptability - as guiding principles in the design of the language itself.</p>
<p>The GO developer community says the <strong>Gopher</strong> has become a symbol of the Go community's shared values and goals, including a commitment to open source, a focus on practical and real-world problems, and a dedication to collaboration and inclusivity.</p>
<p><img src="https://github.com/egonelbre/gophers/raw/master/.thumb/vector/superhero/lifting-1TB.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-features-of-go">Features of GO</h2>
<ul>
<li><p>It supports different types of datatypes like int, int8, int32.., float32, float64, string, array, slice, etc.</p>
</li>
<li><p>Only supports one loop statement <strong>For.</strong></p>
</li>
<li><p>Statically typed</p>
</li>
<li><p>Every built-in function must be imported to use so it's extremely lightweight.</p>
</li>
<li><p>Support concurrency (goroutine)</p>
</li>
<li><p>Every variable declared must be used otherwise it will show the error "<strong>declared and not used</strong>"</p>
</li>
<li><p>Go support variadic function and closure function</p>
</li>
<li><p>Go support blank identifier to avoid unwanted variable declaration</p>
</li>
</ul>
<h2 id="heading-performance">Performance</h2>
<p><img src="https://assets.toptal.io/images?url=https://uploads.toptal.io/blog/image/126911/toptal-blog-image-1534449565382-9c3f283d73f19b6d1164372e9b2611ea.png" alt="Total number of requests per second, N=1, 5000 req/sec" /></p>
<p>From the above graph, we have a clear picture that the <strong>GO</strong> programming language has high performance during CPU-intensive operations. When the process becomes more CPU intensive <strong>go</strong> outperforms other programming languages. To read more about performance read the <a target="_blank" href="https://www.toptal.com/back-end/server-side-io-performance-node-php-java-go">article</a>.</p>
<h2 id="heading-packages">Packages📦</h2>
<p>As other programming languages, GO also provides some packages for developers to work on. Officially released GO packages can be visible on the package website of go <a target="_blank" href="https://pkg.go.dev/">pkg.go.dev</a>. You can also find go packages written by developers on GitHub.</p>
<h2 id="heading-playground">PlayGround</h2>
<p>Get your hands dirty with GO. If are still confused about whether to learn Go you can try it @ <a target="_blank" href="https://go.dev/tour/welcome/1">Playground</a></p>
<h2 id="heading-community">Community💪🏽</h2>
<p><img src="https://github.com/egonelbre/gophers/raw/master/.thumb/vector/superhero/gotham.png" alt class="image--center mx-auto" /></p>
<p>Go is building a strong community. Get in touch with the <strong>GO</strong> community and attend offline meetups @<a target="_blank" href="https://www.meetup.com/pro/go/">Meetup</a>. Find <strong>go</strong> user group on this GitHub <a target="_blank" href="https://github.com/golang/go/wiki/GoUserGroups">repository</a></p>
<h2 id="heading-opensource-projects">OpenSource Projects⏳</h2>
<p>Go had made a great change in open-source project contribution. Most trending open-source projects are developed using <strong>GO</strong>. Some major GO open-source projects are:</p>
<ul>
<li><p><strong>Docker/CLI</strong> 🐳</p>
<p>  Docker is a tool that helps developers package and run their applications in a consistent and portable way. It allows you to create a container, which is a lightweight and isolated environment that contains everything needed to run your application.</p>
<p>  <a target="_blank" href="https://github.com/docker/cli">GitHub Repository</a></p>
</li>
<li><p><strong>Kubernetes</strong></p>
<p>  Kubernetes is an orchestration tool for managing and scaling containerized applications across multiple machines. It automates resource allocation and ensures high availability and scalability.</p>
<p>  <a target="_blank" href="https://github.com/kubernetes/kubernetes">GitHub Repository</a></p>
</li>
<li><p><strong>Argo</strong></p>
<p>  Argo is a tool for managing and orchestrating complex workflows in Kubernetes. Argo enables you to automate and streamline your workflows, reduce manual errors, and increase productivity.</p>
<p>  <a target="_blank" href="https://github.com/argoproj/argo-cd">GitHub Repository</a></p>
</li>
<li><p><strong>Hugo</strong></p>
<p>  Hugo is one of the most popular open-source static site generators out there. Over 29k live websites are built with HUGO and Wappalyzer reports that Hugo serves almost 50% of the static sites. Oh and guess what, Kubernetes’ own site is built using HUGO!</p>
<p>  <a target="_blank" href="https://github.com/gohugoio/hugo">GitHub Repository</a></p>
<p>  Find the currently trending <strong>GO</strong> repository at <a target="_blank" href="https://github.com/trending/go">GitHub</a>.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[GO project: Gorm connect with mysql docker]]></title><description><![CDATA[How to use a docker container as a MySQL service for a GO project? How to connect with MySQL docker container?
In this blog, we are discussing how to use MySQL container as a service in a go project with the gorm package.
Below is a docker-compose fi...]]></description><link>https://www.hashnode.joyaldev.me/go-project-gorm-connect-with-mysql-docker</link><guid isPermaLink="true">https://www.hashnode.joyaldev.me/go-project-gorm-connect-with-mysql-docker</guid><category><![CDATA[Go Language]]></category><category><![CDATA[dockermysql]]></category><category><![CDATA[go connect with mysql]]></category><category><![CDATA[mysql-docker-gorm]]></category><category><![CDATA[gorm+mysql docker ]]></category><dc:creator><![CDATA[joyal raphel]]></dc:creator><pubDate>Mon, 20 Mar 2023 13:40:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1679318986590/a0e668e9-922f-4227-8228-5004e48dcc41.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>How to use a docker container as a MySQL service for a GO project? How to connect with MySQL docker container?</p>
<p>In this blog, we are discussing how to use MySQL container as a service in a go project with the gorm package.</p>
<p>Below is a docker-compose file which will create a MySQL container. Save it as <mark>docker-compose.yaml</mark> file.</p>
<pre><code class="lang-plaintext">version: '3'

services:
  mysql_db:
    image: mysql:latest
    restart: always
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: 123
      MYSQL_ROOT_HOST: '%'

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:5.0.2
    restart: always
    ports:
      - 9001:80
    environment:
      PMA_HOST: mysql_db
    depends_on:
      - mysql_db
</code></pre>
<p>Run <code>docker-compose up -d</code> to start containers.</p>
<p>In the above example, you can access PhpMyAdmin at http://localhost:9001. Login to the account using username: root and password: 123.</p>
<p>Sample GO program to connect with MySQL service is shown below. Copy and paste the code into the main.go named file.</p>
<pre><code class="lang-plaintext">package main

import (
    "fmt"
    "github.com/jinzhu/gorm"
    _ "github.com/jinzhu/gorm/dialects/mysql"
)

type User struct{
    gorm.Model
    Name string `json:"name"`
}

var db *gorm.DB
var err error

func main() {
    db, err = gorm.Open("mysql","root:123@tcp(0.0.0.0:3306)/sample?charset=utf8&amp;parseTime=True")
    if err != nil{
        panic(err)
    }else{
        fmt.Println("Connected DB")
    }
}
</code></pre>
<p>Run the above code if you get the print statement Connected DB you have successfully connected your GO project with MySQL docker container.</p>
<h3 id="heading-note">Note:</h3>
<ul>
<li><p>Don't forget to create 'sample' database in MySQL. You can use PhpMyAdmin for creating it.</p>
</li>
<li><p>Before running the above GO file you should get all the packages you have imported.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1679318321872/e6b3b713-79eb-41d2-8d0e-413392c555c5.png" alt /></p>
]]></content:encoded></item><item><title><![CDATA[Docker for Beginners]]></title><description><![CDATA[What is Container?
It is a way of packaging an application with all necessary dependency files and configuration files. Containerised applications are very easy to move and share in between, for example, applications are shared between the developmen...]]></description><link>https://www.hashnode.joyaldev.me/docker-for-beginners</link><guid isPermaLink="true">https://www.hashnode.joyaldev.me/docker-for-beginners</guid><category><![CDATA[docker for beginners]]></category><category><![CDATA[container beginners]]></category><category><![CDATA[docker familarize]]></category><dc:creator><![CDATA[joyal raphel]]></dc:creator><pubDate>Sat, 25 Feb 2023 11:23:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1677261648354/6031200d-92c7-4441-a712-388fca2241d1.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-container">What is Container?</h2>
<p>It is a way of packaging an application with all necessary dependency files and configuration files. Containerised applications are very easy to move and share in between, for example, applications are shared between the development and operation teams via containers. Containerisation will increase the efficiency of development and deployment.</p>
<h2 id="heading-why-containers">Why containers?</h2>
<h3 id="heading-application-development">Application Development</h3>
<p>Before containers during the development of an application, if team members are using different OS the installation of different services like mongo, mongo-express for the application development will be different. It will be also a time-consuming step.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676226430424/2e909e13-1b3d-4073-b639-44b17bc7bc15.png" alt /></p>
<p>With Containers, you are installing each service not directly to your OS rather the images of each service are pulled. Since it doesn't depend on your host OS the service will be the same for each team member. Also, each service can be installed with a simple command <code>docker run &lt;image&gt;</code> .</p>
<h3 id="heading-application-deployment">Application Deployment</h3>
<p>Before the container, the developer team will send the application to the operation team with a set of instructions. The operation team has to set the environment suitable for the application to run according to the instruction. The problem is there is a chance of misunderstanding between the operation and developer teams which will result in back forth communication and delays deployment of the application. Also if the developer team miss any configuration step this can cause big trouble.</p>
<p>Now the developer and operation team can collectively containerise the application. The Containerised application will be easy to deploy on the server. The only task to deploy an application is to pull the containerised application to the server.</p>
<p>Also, users can run different versions of the same application in the same system with the help of containers.</p>
<h2 id="heading-layers-in-container">Layers in container</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676227821895/8f95dce7-9ec3-4c40-8a8a-5fec44dd232a.png" alt /></p>
<p>A container contains different layers of images. The base layer of the container will be a Linux image which provides the container with an isolated OS. The Application image will be at the top. The container will contain many intermediate layers of images. Each layer of the image is identified by a unique id.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676308549471/99d7bd33-8916-431b-8340-2512418de79f.png" alt /></p>
<p>The major advantage of layers in the container is shown in the above example, firstly I have pulled MariaDB:10.4 since my local repository doesn't have MariaDB it pulled all different layers of image from the docker hub. Later I pulled MariaDB:10.5 but now rather than pulling all layers of images from the docker hub it checked locally for similar images and it only pulled image layers that are not present locally.</p>
<h2 id="heading-storage-for-containers">Storage for Containers</h2>
<p>Containers are stored in a <strong>container repository</strong>. Mainly there are 2 types of container repositories, private repositories and public repositories.</p>
<p>Private repositories are owned by companies and are used to store the containerised application of the company. Amazon has amazon ECR to store docker images in a private repository. Whereas a public repository is available to all, the public repository for docker is <a target="_blank" href="https://hub.docker.com/">DockerHub</a>. Containerised applications present in the public repository are free to use.</p>
<h2 id="heading-container-vs-image">Container vs Image</h2>
<p>The actual package that contains the application along with all its dependencies and configuration files is called Image. Images can be moved around between team members.</p>
<p>When an image is pulled to a computer and the image is started, now this creates a container. Shortly, if the package is not running it's called an image, if running it's called a container.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676313325450/5cbcb46c-23cc-48b1-b5c4-9152b8d8dc7e.png" alt /></p>
<h2 id="heading-docker-vs-vm">Docker vs VM</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676383653199/516f29b9-70c4-4f7f-afcd-7c3a409d681f.png" alt class="image--center mx-auto" /></p>
<p>An operating system can be classified into 2 layers kernel and application layer. The kernel layer is used to communicate with hardware components whereas, the application runs over the OS kernel layer. Docker virtualises the application layer of the OS, which means it uses the host OS kernel. Whereas Virtual Machine virtualises both the application and kernel layer of the operating system.</p>
<p>The Size of the docker image will be less as compared to VM. Docker image starts and runs fast as compared to VM. Older versions of Mac and Windows may not support docker.</p>
<h2 id="heading-docker-installation">Docker installation</h2>
<p>To install docker, head over to <a target="_blank" href="https://docs.docker.com/get-docker/">Docker's</a> official website and download the suitable docker desktop for your OS. You can learn docker with fun through <a target="_blank" href="https://labs.play-with-docker.com/">docker playground.</a></p>
<h2 id="heading-basic-commands-in-docker">Basic commands in Docker</h2>
<ul>
<li><p>docker pull &lt;image&gt;:</p>
<p>  This command is used to pull an image of an application to your local repository</p>
</li>
<li><p>docker run &lt;image&gt;:</p>
<p>  This command runs an image and creates an instance(container) of it.</p>
</li>
<li><p>docker ps:</p>
<p>  This list all the containers running instantly.</p>
</li>
<li><p>docker images:</p>
<p>  The above command will list all the image files in the local storage.</p>
</li>
<li><p>docker stop &lt;container id&gt;:</p>
<p>  Above command is used to stop a running container.</p>
</li>
<li><p>docker start &lt;container id&gt;:</p>
<p>  This command can be used to restart a stopped container.</p>
</li>
<li><p>docker ps -a:</p>
<p>  This command displays all the containers running and not running.</p>
</li>
<li><p>docker run -p&lt;host-port&gt;:&lt;container-port&gt; &lt;image&gt;:</p>
<p>  The above command is used to bind a host port and a container port of an instance of an image.</p>
</li>
<li><p>docker logs &lt;container-id/unique-name&gt;</p>
<p>  This command displays all the logs of the corresponding image.</p>
</li>
<li><p>docker run --name &lt;unique name&gt; &lt;image&gt;</p>
<p>  <strong>--name</strong> flag can be used to give a custom name to the container.</p>
</li>
<li><p>docker exec -it &lt;container-id&gt; /bin/bash</p>
<p>  The above command is used to get into the terminal of the running container.</p>
</li>
</ul>
<h2 id="heading-workflow-of-docker-in-development">Workflow of Docker in Development</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676612479067/2ffffdea-d1e1-4844-a774-1b887d58d1a2.png" alt /></p>
<p>In the development phase, the application is built. Code is commited using version controller <strong>git.</strong> Jenkins is a Continuous Integration tool which will build the application and generate an image of the same using <strong>Dockerfile</strong>. Companies use <strong>private container repositories</strong> to store images. Further, the image is pulled from the Container repository to the server and it is deployed.</p>
<h2 id="heading-docker-compose-vs-docker-run">Docker compose vs Docker run</h2>
<p>We can use both <strong>docker-compose</strong> or <strong>docker run</strong> to run a container. Containers created through YAML files (docker-compose) will be more structured and easier way to edit. Below show what <strong>docker-compose</strong> and <strong>docker run</strong> looks like. Both of the operations end up creating containers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1676702040874/3f8146d3-0355-4ffc-827c-a9eb1ea4cbaa.png" alt /></p>
<p>In Docker compose (LHS) we mention port binding under the property <strong>ports</strong> in yaml file whereas in Docker-run we use the flag '<strong>-p</strong>' to specify port binding. Also, we can see on the right-hand side we are explicitly mentioning the container network for <strong>mongo-express</strong> and <strong>mongo</strong> so that both containers can communicate with each other, but the containers created by docker-compose are relaying in the new container network by default.</p>
<h2 id="heading-docker-file">Docker file</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1677262248546/51c73849-5a4e-47cb-990d-db7165624a17.png" alt /></p>
<p>Dockerfile is a blueprint for creating docker images. We can create custom images for our application using <mark>Dockerfile</mark>.</p>
<pre><code class="lang-plaintext">FROM node:13-alpine

ENV MONGO_DB_USERNAME=admin \
    MONGO_DB_PWD=password

RUN mkdir -p /home/app
COPY ./app /home/app

CMD ["node","/home/app/server.js"]
</code></pre>
<h3 id="heading-major-contents-of-dockerfile">Major contents of Dockerfile</h3>
<ul>
<li><p><code>FROM</code>: we always need a base image with which our application image can be created like Node, PHP, Ubuntu etc...</p>
</li>
<li><p><code>ENV</code>: Used to define environmental variables. Not recommended method for creating environmental variables.</p>
</li>
<li><p><code>RUN</code>: Used to execute any Linux command inside the container.</p>
</li>
<li><p><code>COPY</code>: Used to copy files from host to container.</p>
</li>
<li><p><code>CMD</code>: CMD is an entry point command.</p>
</li>
</ul>
<p><code>docker build -t my-app:1.0 .</code></p>
<p>The above <code>build</code> command is used to generate your custom image. <code>-t</code> flag is used for mentioning the Image name (my-app) followed by its tag(1.0). The <code>.</code> indicate that Dockerfile is present in the current working directory.</p>
<p><img src="https://github.githubassets.com/images/icons/emoji/octocat.png" alt=":octocat:" class="image--center mx-auto" /></p>
<p>To get practical experience in creating Docker Images for your application head over to git repository demo. <a target="_blank" href="https://github.com/joyal007/Docker-Container-Demo"><strong>Docker-Container-Demo</strong></a></p>
]]></content:encoded></item></channel></rss>