Introduction to Go Programming Language

Introduction to Go Programming Language


Golang is an open-source programming language and it developed at Google in the year 2007 by Robert Griesemer, Ken Thompson and Rob Pike. Go programming language is a compiled, interpreted language and statically-typed language with syntax. similar to, that of C. It provides garbage collection, dynamic-typing capability, type safety many advanced built-in types such as key-value maps and variable-length arrays. It’s fast, also provides a rich standard library.


1. Clean and Simple syntax:

The syntax is simple and You should be able to do a lot in only a few lines of code. it’s made easy to write code that is maintainable and readable.

2. Easy to write concurrent programs

Go makes it easy functions to run as very lightweight threads. As a result, writing multithreaded programs is a piece of cake.
So, These threads are known as goroutines bin Go.

3. Channels

The channels can establish communication between goroutines. using pipes which Goroutines communicate. the data can be sent from one end and received from another end uses channels.

4. Compiled language

It is a compiled language. also compiles quickly to machine code yet has the convenience of the power of run-time reflection and garbage collection.

5. Fast compilation

The Compilation and execution are fast. The goal is to be as fast as C. Compilation time measured in seconds.

6. Static linking

The Go language compiler supports static linking. All the Go code can be statically linked into binary and it can deploy in cloud servers easily without any dependencies.

7. Opensource

Go is an open-source project. also, the license is completely open-source. You can contribute and participate in the Go project.

8. Garbage collection

Go also has garbage collection and you don’t have to worry about memory deallocation. To memory allocate in Go, It has two primitives, new and makes. They do various things and apply to various types, which can be confusing, however, the rules are simple.

9. Safe

Explicit casting and strict rules when changing over one kind to another. Go has garbage collection, no any more free() in Go, the language takes care of this.

Environment setup

1. Installation on Windows

Download and install the latest 64-bit Go MSI and distributable using this link

Use the MSI file and follow the command prompts to install the Go programming tools.

The installer uses the Go distribution in c: \Go, By default.

The installer should set the c:\Go\bin directory in the Windows PATH environment variable. Restart any open prompts for the change to take effect.

Your First Program “Hello World”

So here it is, “Hello World” in Go.

First Hello World Program using Go Language

0. This first line is simply required. All Go files begin with package, package main is required for a standalone executable.

1. This says we need fmt in addition to main. A package other than main is generally known as a library, a familiar concept in other programming languages. The line closes with a comment which begun with //.

2. This is additionally a comment, but this one enclose in /* and */;

3. Similarly, as the package main require to be first, import may come next. In Go programming, is in every case first, then import, then everything else. When your Go program executes, the primary function called will be main(), which mimics the behavior from C. Here we declare that function.

4. On line 4 we call a function from the package fmt to print a string to the screen. the string encloses with double quotes ” and may contain non-ASCII characters. Here we use Greek and Japanese.

Compiling and Running Code

The preferred method to build a Go program is to utilize the go tool. To build HelloWorld we.

simply enter:

% go build helloworld.go

This results in an executable called HelloWorld.

% ./helloworld


Hello, world; or καληµϵρα κ ´ óσµϵ; or こんにちは世界

Leave a Reply

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