Golang Getting Started

Golang Getting Started

Introduction

Course Objective

Datatypes and variables

Operators and Control Flow

Arrays, Slices and Maps

functions

Pointers

Structs, Method and Interfaces

Why Golang?

  • It is one of the most popular programming language.

  • Written in Go Docker and Kubernetes Company uses are Google twitch Uber M Soundcloud daily motion

Introduction and Installation

  • Golang created by the engineer at Google.

Go was created to combine:-

  1. The ease of programming of an interpreted, dynamically typed language (Such as Python)

  2. With the efficiency and safety of a statically typed, compiled language. (such as C++)

  3. It also aimed to be modern, with support for networked and multicore computing.

Install Golang

  1. Click on this Golang

  2. Search and download msi file for window.

  3. And open CMD and type go version.

  4. Create a folder mkdir workspace and Create a file main.go.

  5. Then Open VS Code Type below code of Hello World.

package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}
  1. Then Open terminal with shortcut control+shift+`

  2. Type go run main.go

Your first Go Program

package main

Must start with package name in Go Package keywords and then name to make executable program

import fmt

"fmt" Short form for format

main

Special type of function and it is the entry point of the executable programs.

fmt.Println

Dot operator is known as the member access operator used to access member of the package anything in double quote becomes string

Type of Comments

Single line comment

// comment

Multi line comments

/*
mulit
line
*/

That's great if you have make till here you have covered basic of Golang Introduction and Installation with your first go program.

If you liked what you read, do follow and any feedback for further improvement will be highly appreciated!

Thank you and Happy Learning!👏