Collapse replaces the homedir in absolute paths with `~`.
E.g. `/home/user/foo` will be rewritten to `~/foo`. Relative paths are
returned as is. If GOOS is windows this func does nothing. Panics if
discovery of the home directory fails.
expand expands the path to include the home directory if the path
is prefixed with `~`. If it isn't prefixed with `~`, the path is
returned as-is. Panics if discovery of the home directory fails.