This is a simple “Hello World” example written in Go. Below is the code snippet:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Copy the code into a file named main.go
and run it using the following command:
go run main.go
You should see the output:
Hello, World!
That’s it! You’ve just written and executed your first Go program.