golangThere are still some incompatibilities among different versions. Recently, we encountered some problemsgo-microThe framework can only run in go 1.13 ~ 1.14, but I installed it under windows
1.15So you need to install other versions of golang, so many versions
golangHow to use
WindowsIt’s coexistence on the Internet.
If you find that the command does not work during the following operation, you can open a new command line window and try again.
Next, I will introduce the four solutions I have tried. The best solution is the fourth one, and the first and third failed.
Install golang in windows and run it in CMD
$ go verstion go version go1.15.2 windows/amd64
Because it is configured in the path variable
binDirectory, so it can run directly in CMD
Can I create a new folder without deleting the original golang
C:\Go1.13To store our new version of golang.
Run the newly downloaded setup
UninstallIt doesn’t matter. We’ve got it
PATHRemoved. He can’t find the deleted directory.
Enter the new directory we configured for him
After the installation, I was dumbfounded, other files are installed in the
C:\Go1.13And this is installed in the
C:\GoIn the catalogue
The previous installation
Go1.15.2It was unloaded. I just want to create a directory
C:\Go1.15.2, to re install go 1.13.14, I deleted the path, but it still found the file and deleted it.
Therefore, it is not feasible to install different versions of golang through multiple directories.
This isOfficial advice！
#You can also get other versions of golang $ go get golang.org/dl/go1.15.2 #Download this step can not be less $ go1.15.2 download #Check it out $ go1.15.2 version go version go1.15.2 windows/amd64 #Default golang version $ go version go version go1.13.14 windows/amd64
%USERPROFILE%\go\binUnder the directory
Note that the above methods need to access Google services, so you understand.
You not only need to set HTTP proxy, but also need to set git global proxy!
The following commands are run in Git bash environment, not windows CMD environment!
$ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) #Proxy access $ bash < <(curl -x socks5://james:[email protected]:8080 -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) Cloning from https://github.com/moovweb/gvm.git to /c/Users/wojia/.gvm Created profile for existing install of Go at C:\Users\wojia\.g\go Installed GVM v1.0.22 Please restart your terminal session or to get started right away run `source /c/Users/w/.gvm/scripts/gvm`
The last line prompts us to open a new terminal and run the command
source /c/Users/w/.gvm/scripts/gvmLet’s see what’s going on inside.
$ cat /c/Users/w/.gvm/scripts/gvm export GVM_ROOT=/c/Users/w/.gvm . $GVM_ROOT/scripts/gvm-default
This is obviously a configuration script.
Add GVM in Windows_ After the root environment variable, take a look at the configuration script.
unset GOROOT unset GOARCH unset GOOS unset GOPATH unset GOBIN unset gvm_go_name unset gvm_pkgset_name mkdir -p "$GVM_ROOT/logs" > /dev/null 2>&1 mkdir -p "$GVM_ROOT/gos" > /dev/null 2>&1 mkdir -p "$GVM_ROOT/archive" > /dev/null 2>&1 mkdir -p "$GVM_ROOT/archive/package" > /dev/null 2>&1 mkdir -p "$GVM_ROOT/environments" > /dev/null 2>&1 export GVM_VERSION=$(cat "$GVM_ROOT/VERSION") export PATH="$GVM_ROOT/bin:$PATH" export GVM_PATH_BACKUP="$PATH" [ -f "$GVM_ROOT/environments/default" ] && . "$GVM_ROOT/environments/default" . "$GVM_ROOT/scripts/env/gvm"
In other words, you need to configure environment variables
After configuration, try it.
$ gvm install go1.4 C:\Users\w\.gvm/scripts/functions: line 3: C:\Users\w\.gvm/scripts/function/*: No such file or directory
It seems that shell script is not adjusted for windows, and GVM is not compatible with windows.
Finally, let’s take a lookg
For windows, go directly to GitHub release page to download the target file:
Directly decompress the
PATHJust drop it in the directory
$ g -v g version 1.2.0 #Installation successful!
For windows, the original
PATHRemove from, add to
If GoLand import reports an error, it needs to be adjusted
It needs to be adjusted to
Query currently available for installation
stableThe go version of the state
$ g ls-remote stable 1.13.15 1.14.7
Install target go version
$ g install 1.14.7 Downloading 100% |███████████████| (119/119 MB, 9.939 MB/s) [12s:0s] Computing checksum with SHA256 Checksums matched Now using go1.14.7
Query the version of go that has been installed locally
$ g ls 1.7.6 1.11.13 1.12.17 1.13.15 1.14.6 * 1.14.7
Query all go versions available for installation
$ g ls-remote 1 1.2.2 1.3 1.3.1 ... // omit several versions 1.14.5 1.14.6 * 1.14.7 1.15rc1
Switch to another installed version of go
$ g use 1.14.6 go version go1.14.6 darwin/amd64
Uninstall an installed version of go
$ g uninstall 1.14.7 Uninstalled go1.14.7
For now (October 2020), the,gyes
WindowsThe best in the world
golangMulti version management software,
golangThe official plan is also good, but it works
goCommands need to add version number, easy and easy
gvmNot yet adapted
Windows. Open more folders and change
PATHIt’s just a joke. Let’s have fun.
This work adoptsCC agreementReprint must indicate the author and the link of this article