Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Someone started a CLI tool in Go to consumer a web API, however the project isn't going so well, can you help?
branch: refactors

This branch is 11 commits ahead, 7 commits behind GoBootcamp:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
trackerapi
.gitignore
NOTES.txt
README.md
main.go

README.md

CLI Rescue exercise

Setup

  1. Start by forking this repo so you have your own copy.
  2. 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 git@github.com:$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:

  • Replace: github.com/GoBootcamp
  • With: github.com/<github-username>

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

Start rescuing

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 init function.
  • 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.

Something went wrong with that request. Please try again.