Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

gotests fails to be installed #2936

Closed
eraserix opened this issue Dec 10, 2019 · 13 comments · Fixed by #2945, #2948 or #2970
Closed

gotests fails to be installed #2936

eraserix opened this issue Dec 10, 2019 · 13 comments · Fixed by #2945, #2948 or #2970

Comments

@eraserix
Copy link

eraserix commented Dec 10, 2019

What version of Go, VS Code & VS Code Go extension are you using?

% go version
go version go1.12.14 linux/amd64

Describe the bug

When trying to install gotests, I always get an error:
go get github.com/cweill/gotests/...: no matching versions for query "latest"

Steps to reproduce the behavior:

  1. mkdir -p /tmp/tmpmod

  2. echo module tmpmod > /tmp/tmpmod/go.mod

  3. cd /tmp/tmpmod

  4. env GO111MODULE=on go get -u -v "github.com/cweill/gotests/..."
    go: finding github.com/cweill/gotests/... latest
    Fetching https://github.com?go-get=1
    Parsing meta tags from https://github.com?go-get=1 (status code 200)
    go get github.com/cweill/gotests/...: no matching versions for query "latest"

  5. Or alternatively via goproxy:
    env GOPROXY=https://proxy.golang.org GO111MODULE=on go get -u -v "github.com/cweill/gotests/..."
    Fetching https://proxy.golang.org/github.com/cweill/gotests/@v/list
    Fetching https://proxy.golang.org/github.com/cweill/@v/list
    Fetching https://proxy.golang.org/github.com/@v/list
    go get github.com/cweill/gotests/...: malformed module path "github.com/cweill/gotests/...": double dot

What seems to works

I think the problem is caused by a combination of "..." in the path and modules support. Explicitly specifying the binary gotests works:

% env GOPROXY=https://proxy.golang.org GO111MODULE=on go get -u -v "github.com/cweill/gotests/gotests"
Fetching https://proxy.golang.org/github.com/cweill/gotests/gotests/@v/list
Fetching https://proxy.golang.org/github.com/cweill/gotests/@v/list
Fetching https://proxy.golang.org/github.com/cweill/gotests/@v/v1.5.3.mod
Fetching https://proxy.golang.org/golang.org/x/tools/imports/@v/list
Fetching https://proxy.golang.org/golang.org/x/tools/@v/list
go: finding golang.org/x/tools latest
Fetching https://proxy.golang.org/golang.org/x/tools/@latest
@ramya-rao-a
Copy link
Contributor

Thanks for reporting @eraserix

@stamblerre Can you take a look at this? It might be related to the changes we made around the tool installation code.

@stamblerre
Copy link
Contributor

I believe that in the extension we explicitly excluded gotests from being installed in module mode because the Go command did not yet support the ./... wildcard in 1.13. @eraserix: Does it work if you install gotests through the VS Code extension?

@eraserix
Copy link
Author

Yeah, right: https://github.com/microsoft/vscode-go/blob/0.11.9/src/goInstallTools.ts#L145

I checked again on another computer with another version of go (1.13.5).

When I ONLY select gotests for installation, gotests gets installed, but vscode never notices that gotests has been installed and just seems to hang (but ~/go/bin/gotests is there)

If I select another go tool AFTER gotests (say golint), both utilities are installed successfully.

I'll check again what error I get from vscode next week.

@stamblerre
Copy link
Contributor

I bet this line is the culprit for VS Code hanging. It should be the check that is here instead. Probably because we never create a go.mod file in the case of a single tool installation, so the go mod tidy must hang or fail when there is no go.mod file. I'll send a fix for this.

@ramya-rao-a
Copy link
Contributor

The fix for this should be available in the latest beta version of this extension. Please try it out and let us know how it goes

@ramya-rao-a ramya-rao-a reopened this Dec 13, 2019
@eraserix
Copy link
Author

The results with go 1.12.14 and go extension 0.11.10-beta.5:

Installing gotests alone works.
Installing gotests as the last selection hangs (gorename + gotests)
Installing gotests as first selection fails (gotests + gomodifytags):

Installing 2 tools at /home/redacted/go/bin in module mode.
  gotests
  gomodifytags

Installing github.com/cweill/gotests/... FAILED
Installing github.com/fatih/gomodifytags SUCCEEDED

1 tools failed to install.

gotests:
Error: Command failed: /usr/bin/go get -v -u github.com/cweill/gotests/...
go: finding github.com/cweill/gotests/... latest
Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)
go get github.com/cweill/gotests/...: no matching versions for query "latest"
go: finding github.com/cweill/gotests/... latest
Fetching https://github.com?go-get=1
Parsing meta tags from https://github.com?go-get=1 (status code 200)
go get github.com/cweill/gotests/...: no matching versions for query "latest"

@stamblerre
Copy link
Contributor

Thanks for trying again! It seems to be something specific to Go 1.12, and I was able to reproduce when I checked out that version. Even though this isn't an issue with Go 1.13, I mailed a PR that I think solves the problem.

@ramya-rao-a
Copy link
Contributor

@eraserix Can you try again with the latest beta version that has the recent fixes

@ramya-rao-a
Copy link
Contributor

The latest version of this extension (0.12.0) has this fix for this issue.

Thanks to @eraserix for reporting and to @stamblerre for the fix :)

Happy Coding!

@eraserix
Copy link
Author

eraserix commented Jan 6, 2020

Unfortunately, I still get an error with go 1.12.14 and go extension 0.12.0. gotests can only be installed successfully as last or only selection.

@dewey
Copy link

dewey commented Jan 6, 2020

Just confirming that I had/have the same issue as @eraserix (Go go1.12.14 and 0.12.0). Installed it as the only one selected in the updater and then it worked.

@ramya-rao-a
Copy link
Contributor

Thanks @eraserix and @dewey

@stamblerre Can you please take a look at this?
I can confirm the same happening on Go 1.12.12

Screen Shot 2020-01-06 at 9 27 45 AM

@stamblerre
Copy link
Contributor

Thanks for the reports. Just mailed #2970 which I believe should be the right fix. GO111MODULE wasn't actually being turned off.

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants