Our first Go language program prints “hello, world” message.
To run the program, copy the code to hello-world.go
and use go run
command.
Open a terminal and execute go run hello-world.go
.
The following is a complete code example.
package main
import "fmt"
func main() {
fmt.Println("hello, world")
}
Below is the program output:
$ go run hello-world.go
hello world