First Program
Classic Hello World Program in Go
Okay, so we are all set up with Go. Now let's create our hands dirty and create a trivial Hello World program. Let's create a file and it hello.go
That's it. We are done with our program and now save it in a file named hello.go
Now Go provides us to compile and run the program in a single command. Fire up the terminal, head in a folder where we saved hello.go
and run
Note: For example code shown here refers to go environment in Ubuntu 18.04. Illustration may change a bit depending upon OS being used
This should output the > Hello World string. Go also provides us a way to compile this program into executables by using go build
Is hello
is an executable generated by go build
. This can be run in terminal
Last updated