Welcome to the Golang Tutorial! This is your very first program. There are exercises below the tutorials.
Related course: Introducing Go: Build Reliable, Scalable Programs
One of the easiest programs:
a program that displays “Hello world”.
Start by creating a new file (hello.go) with this contents:
We import the essentials. Then create the main function which is where the program starts. Finally we output the text “Hello world” with the line:
To run a go program, open the command line. Move into the directory that has your program, like:
You should now be in the directory that has your program (hello.go).
Run the program with the command below.
$ go run hello.go
This will then output the message “Hello, World!” to the screen
Video tutorial below:
- Create a program that shows your name
- Create a program that shows your address