A few suggestions:
- Not recommended to use relative package imports.
- Do not panic. Instead return a (bool, err). This is an idiomatic go.
- check for err before closing the Response body
Relative Imports:
- From personal experience, relative imports are a pain to work with. There is a very good discussion around this here. In short, as posted by Andrew Gerrand, the only reason the go tool supports relative imports is to run the compiler tests, which predate the go tool and the concept of GOPATH.
Do not Panic:
- Return an appropriate error instead of panicking so that caller can handle the error gracefully. The idiomatic way of returning an error is the last return value. I would suggest reading effective go.
Always check errors:
- Almost all the functions return an error. Check those before proceeding. You have deferred close of response body before checking the error which can lead to a panic if the HTTP request fails.