Simple Hello World Program in Golang for beginners


Firstly make sure you have done Golang setup as per
You can start programming once you could run go version command.


Create a file named hello.go:

package main

import "fmt"

func main() {
    fmt.Println("Hello World")
  • Package main is a way to group functions inside the directory.
  • fmt package has methods for console printing and text formatting.
  • main is default method which runs and prints Hello World.

Run program by:

go run hello.go

You can build it and run by:

go build hello.go


Don’t watch the clock; do what it does.
Keep going! :thumbs_up: