Saturday, May 12, 2018

Test your Golang installation is up & running

Hi All,

Today we are going to make simple "Hello World" program to make sure our Golang installation is up and running.

Open your terminal and go to hello folder we make in the last lesson, for me it's,

cd /workspace/go/src/github.com/nisalsp9/hello

After you went there open your text editor I'm going to use gedit, following is the command,

gedit

Now your gedit will open copy and paste following code, 


package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")

}

Note:  Don't worry about all those syntaxes I will teach you about them in upcoming posts,

Now save your code using hello.go as the file name.

Okay, let's compile ( build ) your code by using the following command,

go build


  Now let's run the hello world program, following is the command,

./hello



See you guys in my next post, bye !!!!!!

No comments:

Post a Comment