Design a site like this with
Get started

Merge Conflicts Can Git Out of My Face…

So I decided to add JSON outputs and custom exit codes to my link checking tool WISA, both of these features were to be added separately to the master on different branches, in my case issue-13 and issue-14. So I got to work incorporating the new features.

JSON Output

For JSON output I wrote a struct which contained a string url and an int status which exported to the JSON templates specified in next to the variables, each request would store the responses status code and url into this struct and append it to a slice. I had to be careful with this as I used go routines so I made sure to use a mutex so that I could synchronize each routines access to the slice. Then once the checking was complete I took the slice of structs with my url statuses and marshalled it into JSON formatted data.

I kind of jumped the gun once finishing and I accidentally pushed it to the branch and made a PR but I realized my mistake and had to revert the PR… oops. So, once reverted I hopped into the next branch for the other feature.

Custom Exit Codes

For custom exit codes I simply returned a status value 0 being a good response and 3 being bad or unknown. This would modify another variable that would be the final exit code which is defaulted to 0, if it the checkLink function returned a status of 3 it would set the final exit code, otherwise it would leave it alone.


Now that both features were implemented in their own branches its time to merge them… I checkout to the master branch and merge the first branch:

Flawless. It merged perfectly, now to merge the next branch…

…Not flawless. At all. So this merge has some conflicts and git shoved them all into wisa.go for me to enjoy. The slideshow below includes the conflicts git threw at me.

I had to merge a couple lines as I updates how the checkLink function works for both features, my struct was merged fine as it’s near the top of the file and doesn’t mingle with anything but everything else was sort of a mess, however, I manually changed the conflicts and it was a success and so I committed the changes and pushed it to my master branch.


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: