Golang
01. Hello World

Hello World

Let's write our first program in Go.

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

How to Build?

To build the program, run the following command:

go build hello.go
💡

The above command will create an executable file named hello

How to Run?

To run the program, execute the following command:

./hello

Efficient way to run the code

You can also run the code without creating an executable file. To do so, run the following command:

go run hello.go
💡
The above command will compile and run the code in one step.