others-how to solve 'gopkgs: failed to install gopkgs,module found,but does not contain package' problem when running golang module ?

Problem

When we run a go module, we get this :

Tools environment: GOPATH=/Users/bswen/GoProjects
Installing 1 tool at /Users/bswen/GoProjects/bin in module mode.
  gopkgs

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED

1 tools failed to install.

gopkgs: failed to install gopkgs(github.com/uudashr/gopkgs/v2/cmd/gopkgs): Error: Command failed: /usr/local/go/bin/go get -v github.com/uudashr/gopkgs/v2/cmd/gopkgs
go: downloading github.com/uudashr/gopkgs/v2 v2.0.1
go get github.com/uudashr/gopkgs/v2/cmd/gopkgs: module github.com/uudashr/gopkgs@upgrade found (v0.0.0-20200214083640-4d0f738b8305), but does not contain package github.com/uudashr/gopkgs/v2/cmd/gopkgs
 undefined  

The core error is : gopkgs: failed to install gopkgs, module github.com/uudashr/gopkgs@upgrade found (v0.0.0-20200214083640-4d0f738b8305), but does not contain package

Why do this error happen? The dependencies are all correct, I promise!!!

Environment

  • go version go1.14

Reason

The specifed package is not properly installed in your local GOPATH.

Solution

We should install the dependency manually as follows:

go get github.com/uudashr/gopkgs/cmd/[email protected]

Then we should restart the IDE: vscode.

Run the app again, No error messages ,It works!