Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet: "go tool vet" gives error "invalid command: want .cfg file" #28869

Closed
ugorji opened this issue Nov 19, 2018 · 17 comments

Comments

Projects
None yet
7 participants
@ugorji
Copy link
Contributor

commented Nov 19, 2018

What version of Go are you using (go version)?

$ go version
go version devel +e003c6f971 Mon Nov 19 17:33:37 2018 +0000 darwin/amd64

Does this issue reproduce with the latest release?

I see this issue on tip

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

go tool vet -loopclosure *.go

What did you expect to see?

I expected go tool vet to run successfully.

What did you see instead?

vet: invalid command: want .cfg file (this reduced version of vet is intended to be run only by the 'go vet' command)

I found out about this error because I kept getting it in my emacs messages during development.

The error I got came from flycheck (a well known syntax checker for emacs supporting many many languages and modes). On further investigation into the sub-module of flycheck, I saw that they were executing "go tool vet" and showing me this error on each save.

Suspicious state from syntax checker go-vet: Flycheck checker go-vet returned non-zero exit code 1, but its output contained no errors: vet: invalid command: want .cfg file (this reduced version of vet is intended to be run only by the 'go vet' command)

Try installing a more recent version of go-vet, and please open a bug report if the issue persists in the latest release.  Thanks!
@bcmills

This comment has been minimized.

Copy link
Member

commented Nov 19, 2018

@alandonovan has been refactoring cmd/vet.

@bcmills bcmills added this to the Go1.12 milestone Nov 19, 2018

@Prativa20

This comment has been minimized.

Copy link

commented Nov 20, 2018

I am getting this error as well.

vet: invalid command: want .cfg file (this reduced version of vet is intended to be run only by the 'go vet' command)
make: *** [check] Error 1
The command "make check race release" exited with 2.

go version devel +339e5ff189 Tue Nov 20 20:56:13 2018 +0000 linux/amd64

gabriel-vasile added a commit to gabriel-vasile/mimetype that referenced this issue Nov 25, 2018

@ysmolsky

This comment has been minimized.

Copy link
Member

commented Nov 26, 2018

This has broken the workflow under emacs's flycheck calling go vet.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

@alandonovan @matloob Can you give some background on this? The basic issue is that go tool vet no longer works. But we have documented that as working in the past. Is there any alternative?

@alandonovan

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

Apologies for the slow response--I was hoping to come up with a bright idea, but have had none. My impression throughout the vet redesign, based on discussions with Russ, was that 'go tool vet' was not something we intended to support; furthermore vet analyzers have been increasingly reliant on the well-typedness of their inputs, so the old vet could crash if run directly. But as always, reality is more complicated: supported or not, people were using it, and it was a lot faster than 'go vet', making it attractive for uses such as flycheck, and cmd/vet/all.

The choices are:

  • make Flycheck either use go vet, or not run vet at all. This is unsatisfying for those who use vet through Flycheck.
  • build an alternative analysis driver that works on incomplete packages with missing dependencies. Most Analyzers using the new API do not set RunDespiteErrors, so the new driver should not run them. One could audit those Analyzers, make them robust, and enable RunDespiteErrors, but it's a lot of tricky work; or one could just pretend RunDespiteErrors is true, which is in effect what the old vet did, and deal with crashes and false positives as they occur. This is unsatisfying to users and maintainers of the analysis tools.
  • exhume the old cmd/vet and throw away the new analysis API. This is unsatisfying to users and maintainers of the analysis tools.

None of the options are good, but I know which one I prefer.

I'm sorry I didn't anticipate this problem.

@ysmolsky

This comment has been minimized.

Copy link
Member

commented Nov 28, 2018

I am somewhat confused. @alandonovan, I know that you have refactored go vet. Where can I read about this from the user's point of view? I could not find any documentation explain what happened in details. Where can I learn the difference between go vet and go vet tool? I want to help this issue because I relay on FlyCheck as my daily tool and cannot live without it.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Nov 28, 2018

@ysmolsky At the moment on tip go vet works much as it did before, only better, and go tool vet doesn't work at all. If this is what gets released in 1.12, it will of course be documented in the release notes.

Is it possible for FlyCheck to use go vet rather than go tool vet?

@ysmolsky

This comment has been minimized.

Copy link
Member

commented Nov 29, 2018

@ianlancetaylor I have created a ticket flycheck/flycheck#1523. It is possible to use go vet but we lose some functionality that way.

@alandonovan

This comment has been minimized.

Copy link
Contributor

commented Nov 30, 2018

@ysmolsky You have probably seen this doc https://docs.google.com/document/d/1-azPLXaLgTCKeKDNg0HVMq2ovMlD-e7n1ZHzZVzOlJk which describes the changes from the point of view of analysis tool writers. I have not written a doc from the vet user's point of view because I did not anticipate that there would be any significant changes, although of course I underestimated the significance of removing support for directly executing 'go tool vet'.

@ysmolsky

This comment has been minimized.

Copy link
Member

commented Nov 30, 2018

@alandonovan thank you for the link. I have found temporary solution by switching flycheck to go vet. One thing bothers me: go vet reports syntax errors and stops there. To fix that we would need to pick 2nd options you explained above (about alternative analysis driver that run analyzers with RunDespiteErrors set to true). Is this correct?

@alandonovan

This comment has been minimized.

Copy link
Contributor

commented Nov 30, 2018

@ysmolsky cmd/vet should still run those analyzers that identify themselves as robust in the face of syntax or type errors, but they are a minority. Perhaps more of them could be made robust with fairly marginal effort. It wouldn't require a new analysis driver.

bndw added a commit to bndw/pick that referenced this issue Nov 30, 2018

Fix default encryption type (#187)
Fixes #186

Additionally, updates TravisCI to test with Go v1.9.x -> tip, and and allow tip failures (related: golang/go#28869)
@gopherbot

This comment has been minimized.

Copy link

commented Dec 3, 2018

Change https://golang.org/cl/152217 mentions this issue: go/analysis/unitchecker: improve error message for go tool vet

gopherbot pushed a commit to golang/tools that referenced this issue Dec 3, 2018

go/analysis/unitchecker: improve error message for go tool vet
Previously running "go tool vet" said

vet: invalid command: want .cfg file (this reduced version of vet is
intended to be run only by the 'go vet' command)

With this change it says:

vet: invoking "go tool vet" directly is unsupported; use "go vet"

Updates golang/go#28869

Change-Id: I603ab2f75bb52d860e5cd7466e89d051dfbf3f08
Reviewed-on: https://go-review.googlesource.com/c/152217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
@gopherbot

This comment has been minimized.

Copy link

commented Dec 3, 2018

Change https://golang.org/cl/152257 mentions this issue: cmd/vendor/golang.org/x/tools/go/analysis: update

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Dec 3, 2018

The error message now says

invoking "go tool vet" directly is unsupported; use "go vet"

Our current plan is to declare that go tool vet is no longer supported.

@gopherbot

This comment has been minimized.

Copy link

commented Dec 3, 2018

Change https://golang.org/cl/152161 mentions this issue: doc: release notes: "go tool vet" is no longer supported

gopherbot pushed a commit that referenced this issue Dec 4, 2018

doc: release notes: "go tool vet" is no longer supported
Updates #28869

Change-Id: Ie152bf959af2e9cd32b1ccc031e8208e64fbe3ce
Reviewed-on: https://go-review.googlesource.com/c/152161
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
@ysmolsky

This comment has been minimized.

Copy link
Member

commented Dec 4, 2018

@ianlancetaylor, sounds like a plan. If that is decided, this ticket can be closed as no more work is anticipated here. Other tools ought to be fixed.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Dec 5, 2018

As far as I know everything in the Go project is fixed and there is nothing to do here. We may need to revisit this based on reaction to the beta, but closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.