Skip to content

Instantly share code, notes, and snippets.

@unsafe9
Created March 30, 2020 01:39
Show Gist options
  • Save unsafe9/dd7f80bb92d205d38e4d3aa62c9d9d77 to your computer and use it in GitHub Desktop.
Save unsafe9/dd7f80bb92d205d38e4d3aa62c9d9d77 to your computer and use it in GitHub Desktop.
open go terminal by version
@echo off
if defined GVM_VERSION (
echo ERROR: Cannot export on gvm terminal
exit /b
)
set GVM_VERSION=%1
set GOROOT=C:\Go%1
set GOPATH=E:\golang%1
set PATH=%PATH%;%GOROOT%\bin;%GOPATH%\bin
@echo off
if "%1"=="now" goto current_version
if defined GVM_VERSION goto on_gvm
if "%1"=="help" goto installed_versions
if "%1"=="1.8.3" goto start_gvm
if "%1"=="1.9.7" goto start_gvm
if "%1"=="1.13.9" goto start_gvm
echo ERROR: Uninstalled or invalid golang version
exit /b
:current_version
if defined GVM_VERSION (
echo %GVM_VERSION%
) else (
echo ERROR : Not on gvm
)
exit /b
:installed_versions
echo installed golang version : 1.8.3, 1.9.7, 1.13.9
exit /b
:on_gvm
echo ERROR: Cannot run on gvm terminal
exit /b
:start_gvm
call cmd /k "_gvm_export %1"
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment