Skip to main content

Command Palette

Search for a command to run...

First program in Go

Published
1 min readView as Markdown
First program in Go

In this tutorial , I will share how to install go and create the first program in go

Go to official page of go here. Download the suitable binary file for your system

After downloading the go for your system you can check the go version by this command

go version

Now we can start writing some code in VScode , I hope you have VScode installed

Make a folder, you can give any name but I am giving FirstProgram here. Then enable dependency tracking of your code. This step is not necessary. You can skip it

go mod init FirstProgram

This step is necessary when you want to track and manage the dependencies you add, you begin by putting your code in its own module.

Now make a go file

//main.go
package main
import ("fmt")

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

then run the following command go run main.go