Getting Started with Hello World in Go

Chris Biscardi
InstructorChris Biscardi

Share this video with your friends

Send Tweet
Published 3 years ago
Updated 8 months ago

We'll cover a small Golang program that prints a string to the terminal, showing how to set up an executable program, import a package, and build a binary.

Instructor: [00:00] For our first Go program, we have a single file called main.go. Inside of main.go, we declare the package to be Main. This is the default for all executables. We import format because we're going to be printing a string later and we define a Main func. This is the function that will be called when we execute our executable.

[00:18] Finally, from the format package that we imported, we call print line with "Hello World." We can use Go Run to run our program. Also, since Go is a compiled language, we can run Go Build to build an executable. Now we have an additional file called Main, and when we run it, our program prints.

Erkan Buelbuel
Erkan Buelbuel
~ 2 years ago

I don't like double quotes and single quotes don't work,..