OS : Ubuntu 12.04
Command to install
sudo apt-get install gccgo-go
Now type "go version" to know the version of Go.
here is my output
go version xgcc (Ubuntu 4.9.1-0ubuntu1) 4.9.1 linux/amd64
Now its time to move on to our first hello world program.
Use any editor to create a Go file. Here I am using "vim" editor. Now create a Go file using following command. Depending upon the editor you are using following may differ.
vim hello.go
Now press i to enter INSERT mode and copy the following content
package main
import "fmt"
func main(){
fmt.Printf("Hello, World\n");
}
Now press ":wq" to save and exit from editor.
Enter following command to run and see the output
go run hello.go
output:
That's all for now.
-Enjoy
Command to install
sudo apt-get install gccgo-go
Now type "go version" to know the version of Go.
here is my output
go version xgcc (Ubuntu 4.9.1-0ubuntu1) 4.9.1 linux/amd64
Now its time to move on to our first hello world program.
Use any editor to create a Go file. Here I am using "vim" editor. Now create a Go file using following command. Depending upon the editor you are using following may differ.
vim hello.go
Now press i to enter INSERT mode and copy the following content
package main
import "fmt"
func main(){
fmt.Printf("Hello, World\n");
}
Now press ":wq" to save and exit from editor.
Enter following command to run and see the output
go run hello.go
output:
That's all for now.
-Enjoy
No comments:
Post a Comment