Create and Run the Hello World Program in Golang
Golang programs can be written in a very easy manner, follow the below two steps to create and run the program.
1. Open a text editor, write the following "Hello World" program and save the file with .go extension i.e. HelloWorld.go
Hello World Program - HelloWorld.go
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
2. Run the golang file (i.e. golang program) using the command go run HelloWorld.go.
Alternate way of executing the .go file
Build the golang file (i.e. golang program) using the command go build HelloWorld.go and then run the executable using the filename without an extension HelloWorld.