UPDATE
You need to use modules. Module-based behavior is an opt-in feature that is available from Go 1.11 but it is disabled by default in %GOPATH%
directory. (If you don't know your %GOPATH%
, run go env
.) For example, if your %GOPATH%
is set to C:\Users\Melina\go
(I suppose so in the remainder of the answer), you cannot use module-based behavior of go get
in that directory or its subdirectories likeC:\Users\Melina\go\src
regarding default settings. To change it, do the following steps:
-
Set GO111MODULE
environment variable to on
Add an environment variable called GO111MODULE
and set it to on
. (You can do this simply by running command setx GO111MODULE "on"
in Windows shell either Command Prompt or Windows Powershell. You MUST repoen the shell so it takes effect. Or if you are using Visual Studio Code, restart your IDE.)
In C:\Users\Melina\go\src
, create a directory called e.g. socket.io.1.4
. It will contain source code of socket.io
module. Run the following commands:
cd C:\Users\Melina\go\socket.io.1.4
go mod init github.com/googollee/go-socket.io@v1.4
to create a module that pulls v1.4
of go-socket.io
.
go get github.com/googollee/go-socket.io@v1.4
to get the specified version of the module. Getting the module will start like this:
There is an alternative way without touching GO111MODULE
. Since out of %GOPATH%
, the module-based behavior is enabled by default, you can do step 2 out of %GOPATH%
, i.e. create directory socket.io.1.4
out of C:\Users\Melina\go
and its subdirectories. Other steps are the same.