Design a site like this with
Get started

Working With Git Diffs

For this weeks lab we had to setup telescope on our machines and setup functionality in our link checking tools to validate the status of posts found at the /posts route. I ended up using a virtual machine because upgrading my windows was a pain to get WSL2 and I’m fine with WSL. I followed the environment setup in the documentation and had telescope up and running in no time. Using docker helped make this process much easier and I ended up encountering no issues.

Visiting localhost:3000/posts in the browser of my virtual machine displayed a JSON list of the most recent 10 posts, so now the only thing to do is to check the links statuses with my link checker.

To check the status of posts I created a function which takes a base URL and makes a call to the /posts route and takes all the results which are displayed in a [{"id":"id","url":"url"}] format and marshals every results into an array of post struct I made which holds these two values. Then using the exists link checking function in my tool to check each post url.

Then I created a flag which accepts a URL string and it calls the function I just created to check the posts found on telescope. Below is an example of me running the checker on my machine using the local IP of my virtual machine.

Once the code was done I saved the difference with git diff > lab6.diff and made a gist. That was it, job done everything was fairly straight forward and didn’t require many changes or tweaking.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: