DEV Community

Cover image for Introduction To Go Programming
Samuel K.M
Samuel K.M

Posted on • Updated on

Introduction To Go Programming

#go

The Go programming language is an open source project to make programmers more productive. It is designed at Google by Robert Griesemer, Rob Pike and Ken Thompson. Go is syntactically similar to C, but with memory safety, garbage collection, structural typing and CSP-style concurrency.

Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction.

Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

Why did google build Go?

It is important to understand why google built Go. At the time of Go being built the most popular languages were Python, Java ,C & C++. However this languages had design limitations that would be difficult to patch, therefore Go was developed.

  • Python - easy to use ,but slow
  • Java - Complex Types
  • C & C++ - Fast but has Complex Types & Slow Compilation, at the time of their development machines weren't as powerful as today therefore they were built to work with little memory.

Also at the time of development of this languages, multithreaded systems were rare.

Key Features Of GoLang

  • Strong & Statically Typed
  • Simplicity
  • Fast Compile Times
  • Garbage Collection - you don't have to manage your own memory, the go runtime shall help you manage it.
  • Built In Concurrency Primitives
  • Go compiles down to standalone binaries
How to install Go

Follow this documentation to learn how to install

Useful Links

To practice coding in the browser:

Just like other languages, go has different packages that handle different functions.

To get help

Understanding Go Code
package main

import (
    "fmt"
)

func main() {
    fmt.Println("Hello, playground")
}

Enter fullscreen mode Exit fullscreen mode

Every application is structured into packages, for every file in go you will have to declare which package its part of. The code above, belongs to the main package. The main package is a special package as it is going to be the entry of your application.

The import statement is what we use to import additional libraries. In the above code we are importing the fmt library often pronounced as thumped.

From the fmt library we use the Println() function to print the code
Run this code in the Playground

Top comments (0)