diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b37586f..72c36d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v2 - name: Check GO env variables - run: go env + run: go env && v -e 'import os; os.getenv("PATH").split(os.path_delimiter).map(dump(it))' - name: Check code formatting run: | diff --git a/main.v b/main.v index 929250e..0ea77db 100644 --- a/main.v +++ b/main.v @@ -201,9 +201,14 @@ fn ensure_asty_is_installed() ! { return error('Failed to find Go. Visit https://go.dev/dl/ to see instructions, on how to install it.') } gopath_bin := os.join_path(gopath_res.output.trim_space(), '/bin') - os.setenv('PATH', os.getenv('PATH') + if os.user_os() == 'windows' { ';' } else { ':' } + - gopath_bin, true) - + os.setenv('GOBIN', gopath_bin, true) + os.setenv('PATH', os.getenv('PATH') + os.path_delimiter + gopath_bin, true) + if !os.exists(gopath_bin) { + os.mkdir_all(gopath_bin)! + } + if _ := os.find_abs_path_of_executable(asty_executable_name) { + return + } // Check if asty is installed: asty_installed := os.system('go list -m -json github.com/asty-org/asty@latest > /dev/null 2>&1') == 0 if !asty_installed {