@@ -72,17 +72,16 @@ func GetWslStatus(instName string) (string, error) {
7272 "--verbose" ,
7373 })
7474 if err != nil {
75- return "" , fmt .Errorf ("failed to run `wsl --list --verbose`, err: %w (out=%q)" , err , string ( out ) )
75+ return "" , fmt .Errorf ("failed to run `wsl --list --verbose`, err: %w (out=%q)" , err , out )
7676 }
7777
7878 if out == "" {
7979 return StatusBroken , fmt .Errorf ("failed to read instance state for instance %q, try running `wsl --list --verbose` to debug, err: %w" , instName , err )
8080 }
8181
8282 // Check for edge cases first
83- outString := string (out )
84- if strings .Contains (outString , "Windows Subsystem for Linux has no installed distributions." ) {
85- if strings .Contains (outString , "Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND" ) {
83+ if strings .Contains (out , "Windows Subsystem for Linux has no installed distributions." ) {
84+ if strings .Contains (out , "Wsl/WSL_E_DEFAULT_DISTRO_NOT_FOUND" ) {
8685 return StatusBroken , fmt .Errorf (
8786 "failed to read instance state for instance %q because no distro is installed," +
8887 "try running `wsl --install -d Ubuntu` and then re-running Lima" , instName )
@@ -96,7 +95,7 @@ func GetWslStatus(instName string) (string, error) {
9695 var instState string
9796 wslListColsRegex := regexp .MustCompile (`\s+` )
9897 // wsl --list --verbose may have different headers depending on localization, just split by line
99- for _ , rows := range strings .Split (strings .ReplaceAll (string ( out ) , "\r \n " , "\n " ), "\n " ) {
98+ for _ , rows := range strings .Split (strings .ReplaceAll (out , "\r \n " , "\n " ), "\n " ) {
10099 cols := wslListColsRegex .Split (strings .TrimSpace (rows ), - 1 )
101100 nameIdx := 0
102101 // '*' indicates default instance
0 commit comments