diff --git a/src/os/file.go b/src/os/file.go
index eb2277dece3407e6a2556ee45793e2e561d76eda..61f37f248925bbd7648ee5ae751349ef7869157a 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -387,16 +387,16 @@ func UserCacheDir() (string, error) {
 // On Windows, it returns the concatenation of %HOMEDRIVE% and %HOMEPATH%.
 // On Plan 9, it returns the $home environment variable.
 func UserHomeDir() string {
-	if runtime.GOOS == "windows" {
+	switch runtime.GOOS {
+	case "windows":
 		return Getenv("HOMEDRIVE") + Getenv("HOMEPATH")
-	}
-	if runtime.GOOS == "plan9" {
+	case "plan9":
 		return Getenv("home")
-	}
-	if runtime.GOOS == "nacl" {
+	case "nacl", "android":
 		return "/"
+	default:
+		return Getenv("HOME")
 	}
-	return Getenv("HOME")
 }
 
 // Chmod changes the mode of the named file to mode.