Video:

Project Setup

August 22, 2021

Course Instructor: Elliot Forbes

Hey Gophers! My name is Elliot and I'm the creator of TutorialEdge and I've been working with Go systems for roughly 5 years now.

Every project starts from an empty directory and our’s is no different. Let’s start off by creating a directory called network-cli that will house or project.

Note - You can create this directory anywhere on your local machine. Go no longer requires us to build our projects in specific directories on our machine.

Setting up a GitHub Repo

We’ll need some form of source control management to store the various iterations of our code. For the purpose of this course, I’ll be using GitHub to host my project, if you wish to use a different source control management system then feel free to modify the commands to suit your specific system.

Let’s create a new repository within your GitHub account. We’ll need to get the URL from this to initialize our project in the next step.

Once we’ve created our repository, let’s initialize our project using the git CLI:

git init
git remote add origin URL

Perfect, we can now push any code we have to our new repo!

Go Mod Init

Now that we have an empty directory, the first thing I like to do is to initialize my project using the go mod command:

$ go mod init URL
OUTPUT FROM GO MOD INIT

Adding a README

Let’s also create a README.md file at the root of our project and add some basic information around what our project hopes to achieve as well as a section that will house the commands we need to run/test etc our application:

README.md
Network CLI
============

My super awesome network CLI project.

### Local Development

$ go run cmd/cli/main.go

It’s good practice to create this file and add any commands you find useful to it as and when you need them. As we run any new commands for our project, feel free to also add them to this README so that you don’t have to look back through videos to find these commands!

Conclusion

Perfect, we now have most of the admin out of the way and our project initialized and ready to “Go”! In the next video, we’ll look at creating a lightweight CLI that we can build and run.