On line 233 a new err variable is declared. Hence on line 239 the result of client.Do is assigned to inner scope err and outer scope response. Which means err is never checked there for being nil and it's possible that in outer scope you'll see both response and err being nil. Which in turn leads to nil dereference on line 252.
There is a bug in this chunk of code:
https://github.com/XeroAPI/xerogolang/blob/master/xerogolang.go#L228-L246
On line 233 a new
err
variable is declared. Hence on line 239 the result ofclient.Do
is assigned to inner scopeerr
and outer scoperesponse
. Which meanserr
is never checked there for being nil and it's possible that in outer scope you'll see bothresponse
anderr
being nil. Which in turn leads to nil dereference on line 252.The fix would be to replace line 233 with:
Well at least right now oauth consumer's MakeHttpClient never returns an error, so it's pointless to check it there.