Go: What language is, where does it come from and first contact?

Hello world, my name is Francisco, fcoterroba on the Internet and today I'll bring you a post talking about a prgoramming language. Go (or GoLang).

In a matter of minutes, you will know the reason for the rise of this language, who is behind it, what are its most common applications, what market share it currently has, what it is for and above all, most importantly, we will see the first contact with the language.

The first contact will be based on everything around it, from the installation of everything necessary to start messing around to the main examples that are usually made in any other common language.

If you like programming, I recommend you go through the programming tag where you can find the more than 5 projects that I have uploaded to date in a multitude of different programming languages, including JavaScript, Swift and, above all, Python.

If I have to emphasize one, I especially liked the Link shortener with graphical interface in Python with a somewhat advanced level in the language.

If you have a lower level, I recommend the first steps in Swift or how to make a calculator in python using the terminal.

Before starting, although later I will explain what it is, I will I recommend visiting a post that I uploaded more than a month ago, in which I explain many of the most used computer terms in our day to day. Since, in this post, you will see words that you probably do not sound a lot. 🤯 You can reed the post here.

I also want to remind you that a few months ago I uploaded a video to my YouTube channel, very interesting, focused on home automation. Specifically, we connect, configure and install a smart light bulb 💡 with which you can change its color, turn it off, turn it on and much more simply by using your mobile phone and/or voice assistants such as Google, Alexa, etc. 👇🏻

Now yes, let's start!

Go: What is?

Go (or GoLang, to make it simpler), is yet another programming language.

A few days ago, historic news came out for Python since according to the index TIOBE, study that analyzes technology searches, Python surpassed Java for the first time in history, thus placing 2nd on the list.
Well, paying attention to this study, Golang appears as the 13th most searched language.
Despite being such a young language, it has been one of the few languages capable of advancing 7 positions forward in a single year.

Go's pet is called Gordon, he is a Gopher, a type of beaver-shaped rodent. 😍

"Golang Gopher Go Six Pack" T-shirt by clgtart | Redbubble
He's Gopher

Go is a compiled, concurrent, imperative, structured, object-oriented language.

It is inspired by the syntax of C (although, honestly, it reminds me a lot more of Java) that tries to be as dynamic and versatile as Python by adding the performance intent of C or C++.

The company behind the language is none other than Google.

It was launched in 2009 and has an open source philosophy.

It adds a functionality that does not exist in practically any other programming language (excluding Java) which is the trash's recollector.

In addition, it has, like Python, the possibility of optionally adding semicolons.

According to StackOverflow's developers survey of 2019, Golang is positioned as the 13th most popular, 9th most loved, and 3rd most loved language.
These figures rose 1 and 4 positions respectively and remained the 3rd most liked for another consecutive year.

If you want more information on a theoretical level about the language, I recommend watching the following video, by Víctor Robles.

There is much more technical information at su Wikipedia.

You have me HYPE! 🤩 How is it installed?

Before starting, you should know that Go, on its website, has a kind of playground in which you can do the most basic aspects of the language without any need to install things.

You can visit playground clicking me!

If, on the other hand, and as is normal, you prefer to install on your computer or laptop, follow the instructions 👇🏻

1️⃣ FIRST STEP 1️⃣

The first thing we have to do is access your webpage and click on the button below our friend Gopher.

In the next window, we will have four buttons, one for each type of executable. (Linux, MacOS, Windows and source code). We will choose our operating system and the download will begin.

2️⃣ 2️⃣ SECOND STEP 2️⃣

After a few seconds of downloading, we will obtain the installation file that, in the case of Windows, will allow us to run the application as administrators and carry out the typical installation of next > next > finish.

And with this the installation would be done and functional. We can check it by writing go version in the terminal or command line.

SIMPLE PROGRAMS

Before starting to make our small scripts in Rust, we have to open our favorite code editor (in my case you already know it is VSCodium) and install the official google's extension. It is easy to find, you simply have to write Go in the plugin searcher and install it

If, on the other hand, you decide to work from the terminal, to run the script you will simply have to write go run nombre_del_archivo.go

Now yes, let's start with the HELLO WORLD 👋🏻

The first thing we have to do, on line 1, is declare the name of the main package. It will usually be called main

Next we must import the packages that we are going to use, for now it is simply to print on the screen and little else. import "fmt"

Next, we must declare the function with the same name as line 1 and within this function, the code to display text on the screen. Do you see now why it reminds me of Java? (Now at least there are no semicolons) 🥺

func main(){} and fmt.Println("Lo que quieras que se muestre por pantalla")

package main

import "fmt"

func main() {
	fmt.Println("Hola mundo! Mi nombre es Francisco, fcoterroba en Internet!")
}

The conditions in Go are a mix of Java and Python, going something like this:

package main

import "fmt"

func main(){
	if 20 % 2 == 0{
		fmt.Println("20 es par")
	}else{
		fmt.Println("20 es impar") 
	}
}

We are going to end up doing two very important things, creating variables and making loops.

With a:=5 and b:="Esto es texto" we can make variable declarations. (In this aspect it is similar to Python since the type of variable is not justified, Go, behind it, assigns one, yes.
The loop part is like almost cualquier lenguaje, for contador=numero-donde-empezar; contador<=numero-donde-parar; contador++{}
counter++ is used to increase the counter by one.

package main

import "fmt"

func main(){
	a := 5
	b := "Esto es texto"
	
	for i:=0;i<=a;i++{
		fmt.Println(i)
	}
	fmt.Println(b) 
}

And that's all for today guys, now I'm going to leave you a post on medium.com about Python and Go, by the great Orlando Monteverde in case you want to expand your knowledge on the subject! 🤓

And that would be all for today! I hope you liked doing it as much as I did! I also hope you have a great week and we'll see you here soon! Greetings and remember to follow me on the networks as TwitterFacebookInstagram and LinkedIn. 🤟🏻

Leave a Reply

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