From the course: Learning Go
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Create your first Go application - Go Tutorial
From the course: Learning Go
Create your first Go application
- [Instructor] Each application you create with Go should be in its own unique folder. You can place the folder anywhere you like. The precise name of the folder doesn't matter, but it should be all lowercase, without any space characters. In Codespaces, I'll choose this existing folder in my exercise files. I'll right-click and choose New File. I'll name the file hello.go. The file extension of .go is required. You can name the first part of the file anything you like, but it shouldn't have any space characters. When you build the app later, that is when you compile and turn it into an executable file, the default name of the resulting executable will match the code file's name minus the .go extension. Now add some code. I'll start with package main. The package declaration is required, and it identifies this code file and any other code files that are closely associated with it. Next, create an import declaration. You have to import most of the packages that you use in a Go…