Chapter-1-Run Our First “Hello world” Program

Hexnos
2 min readJul 19, 2023

--

In this chapter, we’re going to write our first Hello world program.

Open your code editor, in my case it’s VS Code Editor.

Create a new file main.go and type the below code :

package main

import (
"fmt"
)

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

Output :

Hello World!

Follow this code and save the file.
You can run this code by terminal command or vs code debugging.
Method 1 — Terminal Command →
Open your vs code terminal, in the vs code navigation bar, select —
Terminal --> New Terminal or shortcut key — Ctrl + Shift + `

A new terminal window will open at bottom of the screen :

Type the command go run main.go and hit enter.

Here you should get the output → Hello World

Or you can run the program by vs code debugging →

After clicking on Start Debugging , then you might get this error on debug console →

This error we’ll cover in Chapter-2 for better understanding. So don’t skip any chapter, if you wish to build the basics strong or you may skip the Chapter-2 if you already know why this error occurs and solution for it.

Next > Chapter — 2

Chapters →

Go Intro & Installation
Chapter — 1
Chapter — 2

--

--