In this video, we’ll be covering how to set up and initialize your project using both the
go CLI as well as the
Initializing Using go mod
Let’s start off by initializing our project using the
go mod init command.
We’ll want to specify the GitHub repo location for our project within the command itself like so:
$ go mod init github.com/TutorialEdge/go-rest-api-course
Now, this will create our
go.mod file that is effectively equivalent to the likes of a
package.json file or a
Now that we have our project initialized, let’s also ensure that we have initialized git within our directory and pointed it at the repository we are using for this project.
Note - You will want to replace this repo location with your own repository.
$ git init . $ git remote add origin firstname.lastname@example.org/path/to/your/repo.git
As you progress through the course, try to ensure that you commit and push the code from each lesson up to your repository with a meaningful commit message that describes what the code changes do and why we are doing them.