In this article, we are going to instruct how to clone the GoDevTips repository locally on your mac. This is important when you want to run codes from one of our articles. At the end of this article you will have a Git client software installed, the repository cloned and able to run Go codes provided from an article.
Installing Git on your mac
Before any Git tasks can be performed, you must install Git on your mac. Follow these installation instructions or if you already have Xcode installed you probably already have Git. To verify if Git is already installed, enter the following command in terminal:
If you don’t have Git installed, you must install Xcode Command Line Tools. The easiest way to install it is through the following command in terminal:
For the full instruction on the installation of the Xcode Command Line Tools read this article.
Git client software
For cloning the GoDevtips repository you can use the Git commands if you are already familiar with Git. The most common used Git client softwares are GitHub Desktop and Source Tree. For this example, we are going to use Github Desktop since that makes it much easier for beginners to get started.
Download the GitHub Desktop .zip file from their official website.
After downloading the .zip file, extract it to gain access to the application.
Drag and drop the application file to the application folder.
Double click GitHub Desktop application to launch it and the macOS/OSX verification and permission process followed.
Cloning the repository
After installing GitHub Desktop, go to the GoDevTips repository and copy the clone URL. Open GitHub Desktop and select the option of cloning a repository and paste the URL click on clone.
Open the project
Once you successfully cloned the repository, you can just open the golangExercise folder in your selected code editor. In this example, we are going to open this folder in Atom, although the procedure is identical through all the other code editors.
Running the project
For this example, we are going to run the multiReturn project. Ones the project is imported, open the
main.go file and enable the terminal in order to navigate to the file. To navigate to the file, enter the following commands:
And to run this project:
go run main.go