Go

By | 27/09/2019

In this post, we will see what Go is and what we have to install, in order to use it.
First of all, what is Go?
Go (known as Golang too) is a programming language created by Google about 10 years ago.
It is an open source project that is distributed under a BSD-style license to make programmers more productive. 
Go is expressive, concise, clean, and efficient programming language.
It’s a faster, statically typed, compiled language that feels like a dynamically typed, interpreted language.
It was made to be very fast and for concurrency and it uses multiple threads with parallel tasks and this can make
your application truly scalable.
Go is perfect for projects that involve distributed networks, cloud services, and other complex back-end technologies. 
For all information, see the official web site: https://golang.org/.

In order to use Go, we have to download and install the binary relase from the official web site https://golang.org/dl/.

I have decide to use Visual Studio Code like IDE for writing GO code, because it is stable and because it has a great extension called “G”, that give us a lot of features like for example IntelliSense, code navigation, symbol search, bracket matching and so on.
In order to install “G”, we open Visual Studio Code, go to Extension, write “Go” into the search box and then we push the “Install” button:

Now, we are ready to write our first “Goland” application.
We open Visual Studio Code and we create a file called first.go:

[FIRST.GO]

// package is used to contain more files in one structure (directory)
package main

// fmt is a library package that contains functionalities related to
// formatting, printing output and reading input from various I/O sources.
import (
	"fmt"
	"time"
)

// The main() function is a special function that is the entry point of an executable program
func main() {
	for i := 0; i < 5; i++ {
		fmt.Println(time.Now())
	}
}



If we run the application, using the command go run first.go, this will be the output:



Category: Go Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *