Writing Our First Program
Explore how to create your first Go program by defining a main package and main function. Understand the role of packages and imports for accessing standard and external libraries. This lesson guides you in writing autonomous Go applications and organizing code effectively.
We'll cover the following...
We'll cover the following...
Hello World!
The following is the Go version of the Hello World! program. Let’s name the following code hw.go and try it:
Each Go source code begins with a package declaration. In this case, the name of the package is main, which has a special meaning in Go. The import keyword allows us to include functionality from existing packages. In our case, we only need some of the functionality of the fmt package that belongs to the standard Go library. Packages that are not part ...