Golang: Compile and Run
Copy and paste the following into a file, name the file “test.go”.
package main import "fmt" func main() { fmt.Println("i love cats") }
To run go program, in terminal type
go run test.go
To compile go program, in terminal type
go build test.go
This will create a compiled file named “test”.
Compiled file can be run directly, for example ./test