whitespace: run go fmt ./...

in order to allow everyone to read it and easy contribution.
use valued type switch

in order to simplify error handling related to types.
The cases handled (and deleted now) are dead code which would never been
reached to to the case already matching the type.
simplify URL builder
Applied changes from nightlyone:simplify
Merge branch 'nightlyone-simplify'