Allow changing the base url (mainly for testing)

Also includes a gofmt commit (feel free to cherry-pick the other commit; I have gofmt as a pre-commit hook.)