Our first lab required us to work with one of our peers on our 0.1 release to test, bring up issues and ameliorate each others work. Many students talked about their progress on our Slack making it easy to find a partner, I worked with Tony Vu as we noticed we were both using Go for our tools. I did however also get some pull requests for adding module files and colours to WISA output from Mo and Andy Yang.
Getting my code reviewed
Tony brought some logic changes to my program to be more inline with the instructions and for code legibility.
- Status code logic was changed to be more specific rather than following a set of classes
- An HTTP
200result should be considered “good” and a400or404considered “bad.” Any other result should be “unknown”
- An HTTP
- Filename checking was changed as well since files cannot have sizes under 0
- Coloured output was added as an extra feature with the use of an improved library
- Go module files were added to simplify building
All the issues that were created we’re also closed with pull requests and the tool no longer has any issues (yet) but of course it can always be taken a step further.
Reviewing my peers code
Looking through Tony’s approach to release 0.1 in Go, I noticed we took different approaches to certain tasks and the general styling of our tools, Tony’s code was modular including multiple packages compared to my scripting approach where I put nearly all my logic in the main function. The building of the tool was also very straight forward, the README had all the info I needed to get it running.
Going through the code I noticed we took different approaches at ensuring go routines were completed, Tony used channels to pass status responses using them like “events” to signify a go routine was finished where as I used the sync package tracking go routines with a WaitGroup.
One of the issues I brought up was the usage of GET vs HEAD in the requests and submitted a pull request to change the two to optimize the tools network code so that when checking multiple links the “body” would not be downloaded and only headers are kept.
Final thoughts
It was nice working with Tony and seeing what other contributors had to bring to the table to make WISA better and I feel open source keeps you on your toes so you can learn to avoid similar issues in the future and potentially learn something new.