- vừa được xem lúc

[ENG] Golang: Part 1 - Installation and Introduction

0 0 11

Người đăng: PHAM HIEU

Theo Viblo Asia

Hi everyone, long time no see, I'm Hieu Pham. I'm very fortunate to have had numerous opportunities while working in the development unit, allowing me to become acquainted with many programming languages. In this article, I will introduce Go (Golang), a programming language that is one of the languages you should learn when becoming a DevOps engineer. (I'm currently in the process of learning to become a DevOps engineer)

First of all, we need to install Go. To do this follow the steps below to install Go on a linux OS.

  1. Download Go from this link: https://go.dev/dl/go1.21.3.linux-amd64.tar.gz (version 1.21.3 at this time)
  2. Extract downloaded archive and copy its contents to the /usr/local directory.
tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
  1. Next, we need to make Go accessible globally by running the following command:
export PATH=$PATH:/usr/local/go/bin
  1. Finally, you can check if Go has been installed successfully by running the command:
go version

By following these steps, you'll have Go installed and ready to use on your Linux system.

For others Operating System, you can use this link to install: https://go.dev/doc/install

Introduction

Golang.png Before we proceed to the next part - how to code, I will first explain to you the reasons why Go (Golang) is a programming language that is quite impressive for our community.

Golang has not only been used by big tech companies such as Google, Meta, Netflix, Microsoft, but it is also a robust language, as far as my knowledge goes. So, what are its strengths ?

  • Go is quite simple to learn and easy to read
  • It's seems powerful performance. (Go is a compiled language, making it more performant than interpreted languages like JavaScript, PHP, etc.).
  • Golang is designed for multi-core processors
  • It is supported by Google.
  • Its performance is on par with C/C++, but its syntax is as simple as Python, PHP, ...
  • Go has concurrency

Golang use for:

  • Web development
  • Cloud & Network Services
  • Command-line Interfaces (CLIs)
  • Development Operations & Site Reliability Engineering.

Getting started: "Hello world"

Every complicated thing comes from smallest thing. Every developer needs learn how to code "Hello, world!". It's absolutely simple when you need print "Hello, world!" on your screen. Create a file which has extension .go and then paste belows code block. We need import "fmt" package to your code and able to use I/O functions like Println, as shown in the code snippet below

package main import "fmt" func main() { fmt.Println("Hello, world!")
}

After saving, we need to run it by command:

go run hello-world.go

You can also compile it to execute:

go build hello-world.go
./hello-world

image.png

Good job! You've taken a step into the world of Go lang.

Summary

In this article, we have known about basic of Go programing language. To delve deeper into this language, we need to acquire more knowledge about it. In the upcoming articles, I will introduce and delve into the details of its components and how to use Go. Thank you for following along to the end of this article. If you feel that helpful for yourself, please consider leaving a vote for my article. Thank you and see you in the next ones.

Bình luận

Bài viết tương tự

- vừa được xem lúc

gRPC - Nó là gì và có nên sử dụng hay không?

Nhân một ngày rảnh rỗi, mình ngồi đọc lại RPC cũng như gRPC viết lại để nhớ lâu hơn. Vấn đề là gì và tại sao cần nó .

0 0 131

- vừa được xem lúc

Embedded Template in Go

Getting Start. Part of developing a web application usually revolves around working with HTML as user interface.

0 0 56

- vừa được xem lúc

Tạo Resful API đơn giản với Echo framework và MySQL

1. Giới thiệu.

0 0 60

- vừa được xem lúc

Sử dụng goquery trong golang để crawler thông tin các website Việt Nam bị deface trên mirror-h.org

. Trong bài viết này, mình sẽ cùng mọi người khám phá một package thu thập dữ liệu có tên là goquery của golang. Mục tiêu chính của chương trình crawler này sẽ là lấy thông tin các website Việt Nam bị deface (là tấn công, phá hoại website, làm thay đổi giao diện hiển thị của một trang web, khi người

0 0 237

- vừa được xem lúc

Tạo ứng dụng craw dữ liệu bing với Golang, Mysql driver

Chào mọi người . Lâu lâu ta lại gặp nhau 1 lần, để tiếp tục series chia sẻ kiến thức về tech, hôm nay mình sẽ tìm hiểu và chia sẻ về 1 ngôn ngữ đang khá hot trong cộng đồng IT đó là Golang.

0 0 75

- vừa được xem lúc

Golang: Rest api and routing using MUX

Routing with MUX. Let's create a simple CRUD api for a blog site. # All . GET articles/ .

0 0 54