CLI Rescue exercise
- Start by forking this repo so you have your own copy.
- clone the repo in your Go path:
github_user=$(git config github.user) mkdir -p $GOPATH/src/github.com/$github_user cd $GOPATH/src/github.com/$github_user git clone firstname.lastname@example.org:$github_user/clirescue.git cd clirescue
Install the dependencies:
go get github.com/codegangsta/cli
Load the project into your editor and do a search and replace:
Commit the change:
git commit -a -m "forking repo requires internal code changes"
If everything is properly setup, you should be able to run your code:
go run main.go
You can use the following demo Pivotal Tracker account:
- Username: gobootcamp
- Password: santamonica
This code was written by someone who just started learning Go. Beginners often make the same mistakes so assume that this is your code and you are now tasked to refactor it. The end goal is to create a CLI to interface with the Pivotal Tracker API.
The first step is to return the user details and to store the user token on the drive so next calls can automatically be made without asking for the user's username and password.
A few hints:
- Understanding Go path's system might be a bit tricky at first.
- Forking the repo might affect your import statements.
- The original author might not have made a good use of packages.
- You more thna likely have some OOP experience, you might want to leverage it in this exercise.
- Checkout the
- Curious about how a 3rd party lib works? Try go doc.
- Simpler is better.
- Look into how to write tests.
- Bonus point for removing 3rd part dependencies.
As always, refer to the Effective Go doc if you have any questions.