Closing milestone bugs using Launchpad’s API

A few years ago I wrote a contrib script for Launchpad’s launchpadlib called ‘close-my-bugs.py’ which attempted to close (aka mark them ‘fix released’) all of your bugs in a project that were targeted to a particular milestone.

For various reasons it grew out of date and when I needed to use it recently, it didn’t work!  Long story short, I just fixed it up and added a couple of new features:

  • You can optionally close just your own bugs, or all the bugs in the milestone
  • You can search for bugtasks targeted against a series in your project (these are not normally picked up when searching in a project’s milestone)

You can grab the code here:

bzr branch lp:launchpadlib

contrib/close-my-bugs.py

Bactrim, herxes and headaches

An update on my progress.  I’m now taking all of Plaquenil (hydroxychloroquine), Akamin (minocycline) and Bactrim (sulfamethoxazole and trimethoprim).  The latter one is relatively new and is to treat the Bartonella co-infection that I have.

I’m not sure if it’s the drugs, the disease or a new herx, but my pericarditis pain is now at new levels and is accompanied with extreme light-headedness to the point of almost losing consciousness.

In addition, I am getting some peeling skin as a side-effect from the Bactrim so I need to reduce its dose.

This disease sucks.

Co-Infection

It turns out I have a co-infection of Bartonella which is most likely to be the thing responsible for the pericarditis.  I get to start on Bactrim this week.  Lovely.

In other news, I have a second herx starting. :(

Herx Force One

ImageI appear to be having a major “herx” reaction to my meds. This is apparently “good” because it means the drugs are working.

Basically, it’s a result of the bacteria dying and spilling their guts into my blood stream – their guts are basically endotoxins to which my immune system suddenly goes “WOOOOAAA!” and kicks off a massive street fight in my body. The symptoms of that are basically huge headaches, mental confusion, fatigue and insomnia. I can say without reservation, yes, they are the fucking symptoms.

Error handling in Go

There’s been a debate raging in some corners of the internet lately about how superior Go‘s error handling is to other languages.  I am going to address some of the points made, here:

Claim 1: It’s impossible to ignore errors in Go, they are “in your face”

This is patently false.  Take this example:

fmt.Println("Hello world")

Pretty innocuous wouldn’t you say?  Well let’s take a look at the language documentation for fmt.Println:

// Println formats using the default formats for its operands and writes to standard output.
// Spaces are always added between operands and a newline is appended.
// It returns the number of bytes written and any write error encountered.
func Println(a ...interface{}) (n int, err error)

So Println can return an error!  Where did we check it?  Well, we didn’t.  Any other claims that it’s OK to ignore it in this case further strengthen my argument.

Some will say that it’s a deliberate choice to ignore the error and I deserve all I get. Well, was it? I didn’t even know that Println returned an error until I looked at the documentation (and who is going to do that for Println?). And that’s the point, if I need to look at the documentation to see that it can return an error, then if I am using a language that raises exceptions I will have also seen its documentation about how it deals with errors.

You could even argue that an exception is superior in this case.  With Go, the code will march on regardless, oblivious to the fact that Println failed.  With exceptions, it’ll fail and show you exactly where it failed.

The language will error at compile time if you try to ignore an error returned as a second value and you only take the first.  But this is trivially bypassed by assigning it to _, which when reading code is easily missed compared to the exception style of “catching then dropping”, because Go itself encourages this style of assigning to _ with its own range statement as a deliberate way of ignoring things that the language is trying to force you to see.

So really in both cases, ignoring the error doesn’t really stand out as wrong.

Here’s a concrete example in Go I was recently shown:

w := bufio.NewWriter(os.Stdout)
for _, name := range ListAll(conf) {
    fmt.Fprintln(w, name)
}
w.Flush()
return

As you can see, the caller completely forgot to check the error returned from Fprintln and Flush and there would be no compiler warning about it.

Claim 2: Exceptions teach developers to not care about errors

Citing an example where someone didn’t catch an exception and the code consequently blew up is really not a good example of this claim.  It’s a bug, for sure and you get a full traceback of your error in the resulting exception, which is handy.  You go away and fix it quickly based on that info.

If I am in the same situation with Go and I ignore a returned error from a function, at some point (which is likely to be nowhere near the place where the error occurred) my code will blow up.  I’ll have to run up the debugger to try and find out where it really occurred though.

Because unused variables in Go are a compile-time error, it’s actively discouraging you from assigning the result of the function to a variable (or you can deal with it, of course).  For anyone who’s not read the full documentation for a function call or missed its return value (we’re all human) as I said above – you’re not even going to notice that you missed it.

Based on this, I can see no difference at all that suggests one way or the other teaches developers to not care about errors.  Developers do care about errors, really, but bugs creep in however careful you are.  And when they do, I’d rather have a decent indication of where the bug is.

Other parts of error handling that I dislike

When you look at the average Go program, you will see a lot of this:

if err != nil {
  return nil, err

This is the recommended way of error handling in in Go.  But this is not error handling, it’s error propagation.  In nearly all languages there will arise situations where in well-factored code you have a low-level error that you need to pass right back up to the entry point for the caller. That means you need this error propagation code in every single place where you check for errors.  There’s no syntactic sugar, just the same three lines everywhere.

For me, this vastly decreases the readability of the code. This is where exceptions excel because inside my own library I can factor the bejeesus out of it into many small functions and if I need to return an error, I just catch a lower-level exception in the top-level function and return something else.  You can do this in Go with a panic(), but it seems to be discouraged.  Panic() feels almost exactly like using exceptions, only the syntax is worse. If Go’s style is to encourage people to handle errors like this, it needs the sugar.

Conclusion

Many people might think that I completely hate Go’s error handling from this post.  That’s not strictly true – I don’t hate it, I just think it can be improved.  I challenge assumptions that I see which state that Go’s error handling is superior in some way, when as far as I can see it’s not that different from other languages in terms of usefulness.

Go is clearly in its infancy.  Most languages will have started out with youthful enthusiasm and realised that some change was needed.  These languages are the successful ones where developers enjoy coding in it and feel productive.  I hope that Go embraces change as it matures and attracts more developers.

I welcome comments on this post – unlike some people I won’t censor them or delete ones I can’t argue with (unless they are outright abusive and use foul language, this is a family blog!).

Headaches

I’ve been experiencing bad headaches all week and today’s is awful.  I don’t know if it’s the drugs starting to work and causing a herx or if I just have a headache from the disease. 400mg of Ibuprofen 2.5 hours ago hasn’t helped much :(

Living with Lyme

Slow killer.

Slow killer.

I am writing this blog post because I want to raise awareness of an increasingly common condition across the world.  This is my history leading up to my recent discovery.

After many years of thinking something was wrong with me and not knowing whether I was crazy or just imagining things, I was recently diagnosed with Lyme Disease.  It is a horrible disease with myriad symptoms (I have about 90% of those listed) that are easily misdiagnosed by doctors.  The disease is caused by a bacteria called Borrelia and is transmitted through tick bites.  Not everyone realises that they’ve had a tick bite and certainly I don’t remember one.

It started with chest pains

I originally visited a doctor a couple of years ago because I was getting a lot of chest pain.  After a short time using a portable ECG monitor he diagnosed me with Atrial Ectopic Beats, a supposedly harmless but sometimes debilitating condition, and I certainly felt debilitated every time my heart started palpitating.  His diagnosis led him to prescribe beta-blockers to help prevent the extra beats that were occurring in my heart.  Needless to say, it didn’t really help me and left me feeling generally worse as my heart was now unable to pump blood at any rate required above doing minimal exercise.  I took myself off these because I felt that I’d rather deal with the occasional chest pain than feel awful 24 hours a day.

The first discovery – pericarditis

Over the next year the condition sporadically got worse and I started getting really sharp pains in my chest.  After a few trips to hospital in the back of an ambulance I was fortunate enough to find a cardiologist who was prepared to do some more investigations rather than brushing things under the rug.  He scheduled me for a Stress Echocardiogram which basically entails ultrasound imaging of your heart before and after running on a treadmill while hooked up to an ECG print.  The upshot of this exam was that my heart was fine, but I was now diagnosed with a new condition called pericarditis.

Pericarditis is an inflammation of the pericardium – the sac that surrounds your heart – and is responsible for causing the palpitations.  I had about 7mm of fluid trapped between my heart and my pericardium.  My initial reaction to this was one of relief.  ”Great!” I thought, now we can treat it.  I was prescribed a course of a medicine called colchicine.  It is usually used to treat gout, but is also known to specifically treat pericarditis quite effectively.

Treatment, but still getting worse

One month after starting to take the colchicine I felt no difference in my symptoms at all.  This left me feeling a little depressed, especially since I’ve been experiencing increasing symptoms and took myself to hospital yet again as I was worried about having a cardiac tamponade, which is fatal if not treated quickly.  I went back to the cardiologist to see what else I could do.  He prescribed me some powerful steroids – immuno-suppressants – the intention being to stop my body from reacting to whatever it disliked that was causing the inflammation around my heart.

At this point I was at rock bottom – the idea of being on steroids to control the condition filled me with dread.  I have previously taken topical steroids for skin conditions and I am all too aware of their nasty side effects.  So, I made a decision to start being more proactive in helping myself and set out to learn more about this condition called pericarditis.

The second discovery

After a bit of Googling I found this pericarditis support group. It was quite reassuring to find a bunch of other people who were going through the same thing as me, although still fairly depressing that many people were either stuck on steroids or just learning to live with the pain.  Eventually I came across this post entitled “Lyme Disease Checklist” – I had never heard of this Lyme thing before so I clicked through and started reading.

What I read in that post has been life-changing.

It was immediately apparent to me that I ticked nearly all of the boxes on the checklist.  It made me realise that things that had been niggling me in the back of my head were actually real and that this could finally be an underlying cause for all of my symptoms.  These are symptoms that are going back for some years now – I had thought that perhaps I was just getting old and some mental faculties were waning as my short-term memory and concentration levels had been bad and getting worse, and suffering from severe fatigue and getting joint pains.  It turns out I can blame it all on Lyme Disease.

Finding a doctor

At this point I realised that my cardiologist was not going to be able to help with this, so I set out to find someone who could.  The support group postings had been very clear about one thing: finding a doctor is not easy.  It seems as though there ‘s a lot of controversy about Lyme and finding a Lyme literate doctor is essential.  This appears to be particularly hard here in Australia as there’s severe resistance to belief that it can be caught here (I caught mine elsewhere though) as it is seen as a northern hemisphere problem.  I discovered the Lyme Disease Association of Australia who put me on to a doctor 2 hours north of Brisbane called Andrew Ladhams.  I drove up to see him for an initial consultation and he recommended that I send some blood to a lab in California that specialises in diagnosing Lyme disease.  I got the results 3 weeks later and they were inconclusive, showing some positive and some indicative test bands.  However since the test is notoriously unreliable the recommendation is that the test is used in conjunction with a medical diagnosis.  Dr Ladhams decided that I should begin a course of treatment of antimalarial and antibiotics.

He also said that based on the test results, it’s possible that the strain of Borrelia I have could be from South East Asia.  I have not been there since the year 2002.  That means I’ve had this disease for over 10 years.

Antibiotics work by attacking bacteria when they are weakest – at the point they divide.  Most bacteria divides every few minutes, but the Borrelia bacteria divides every 12-24 hours.  This means that treatment has to take much longer than a regular course, probably 6-12 months.

I am now two weeks into my treatment.  I am ramping up the antimalarial before starting on the antibiotics.  I am hopeful that I’ll start feeling better in a few weeks, however it remains to be seen whether I will regain all my faculties as permanent damage could have occurred, particularly in my joints.

I will keep blogging about this disease as my treatment progresses, and if anyone reading this has any doubts about their own symptoms I urge you to visit a Lyme literate doctor.  If I make even one person aware and help them out as a result of this blog, I’ll be happy.

Wish me luck!