how to install go language
go language

Let’s Download Go installed from official site

  1. Go to the official Go website and download the appropriate installation file for your operating system.
  2. Run the installer and follow the instructions to complete the installation.
install go language in windows
install go language in windows
install go language in windows

Hello World Program in Go Language

1. Create a Folder in Desktop or anywhere.


2. Open the Folder in any Text Editor (Sublime Text or VSCode).


3. Create a file names “hello_world.go”, Here go is golang file extension.

paste below hello world code

package main

import "fmt"

func main() {
    fmt.Println("Hello World!")
}

you name get error near package main saying “go.mod file not found”, It’s because go language module is not initialized to hello_world.go file, To add the file into go.mod run below cmd as shown in step 4.


4. Open Terminal in IDE

go mod init hello_world.go

This will create a go.mod file and add the file into it.


go language hello world program

run go program go run hello.go

create a executable file go build hello_world.go

run the exe file .\hello_world.exe

Video on Installing Go lang and hello world program