Split imports into logical groups

This change set is result of running goimports -w . on the whole repository.
It's considered a good practice to separate stdlib imports from external imports.