Hello World
- create a file called
hello.go
- add the code from below
- run the code with
go run hello.go
// hello.go
package main
func main() {
println("Hello, World!")
}
This may be the most simple golang program. You could also compile the program to an executable binary.
To do that you would run go build hello.go -o hello
(note: on windows you would add the .exe extension)