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

change 'go tool vet' to 'go vet' #1548

Merged
merged 3 commits into from Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions doc/languages.rst
Expand Up @@ -431,10 +431,6 @@ to view the docstring of the syntax checker. Likewise, you may use

A list of print-like functions to check calls for format string problems.

.. defcustom:: flycheck-go-vet-shadow

Whether to check for shadowed variables, in Go 1.6 or newer.

.. defcustom:: flycheck-go-build-tags

A list of build tags.
Expand Down
38 changes: 5 additions & 33 deletions flycheck.el
Expand Up @@ -7732,7 +7732,7 @@ See URL `https://github.com/golang/lint'."
go-build go-test go-errcheck go-unconvert go-megacheck))

(flycheck-def-option-var flycheck-go-vet-print-functions nil go-vet
"A list of print-like functions for `go tool vet'.
"A list of print-like functions for `go vet'.

Go vet will check these functions for format string problems and
issues, such as a mismatch between the number of formats used,
Expand All @@ -7748,18 +7748,6 @@ take an io.Writer as their first argument, like Fprintf,
(string :tag "function"))
:safe #'flycheck-string-list-p)

(flycheck-def-option-var flycheck-go-vet-shadow nil go-vet
vincekd marked this conversation as resolved.
Show resolved Hide resolved
"Whether to check for shadowed variables with `go tool vet'.

When non-nil check for shadowed variables. When `strict' check
more strictly, which can very noisy. When nil do not check for
shadowed variables.

This option requires Go 1.6 or newer."
:type '(choice (const :tag "Do not check for shadowed variables" nil)
(const :tag "Check for shadowed variables" t)
(const :tag "Strictly check for shadowed variables" strict)))

(flycheck-def-option-var flycheck-go-megacheck-disabled-checkers nil
go-megacheck
"A list of checkers to disable when running `megacheck'.
Expand All @@ -7774,39 +7762,23 @@ enabled. "
:safe #'flycheck-string-list-p)

(flycheck-define-checker go-vet
"A Go syntax checker using the `go tool vet' command.
"A Go syntax checker using the `go vet' command.

See URL `https://golang.org/cmd/go/' and URL
`https://golang.org/cmd/vet/'."
:command ("go" "tool" "vet" "-all"
(option "-printfuncs=" flycheck-go-vet-print-functions concat
:command ("go" "vet"
(option "-printf.funcs=" flycheck-go-vet-print-functions concat
flycheck-option-comma-separated-list)
(option-flag "-shadow" flycheck-go-vet-shadow)
(option-list "-tags=" flycheck-go-build-tags concat)
(eval (when (eq flycheck-go-vet-shadow 'strict) "-shadowstrict"))
source)
:error-patterns
((warning line-start (file-name) ":" line ": " (message) line-end))
:modes go-mode
;; We must explicitly check whether the "vet" tool is available
:predicate (lambda ()
(let ((go (flycheck-checker-executable 'go-vet)))
(member "vet" (ignore-errors (process-lines go "tool")))))
:next-checkers (go-build
go-test
;; Fall back if `go build' or `go test' can be used
go-errcheck
go-unconvert
go-megacheck)
:verify (lambda (_)
(let* ((go (flycheck-checker-executable 'go-vet))
(have-vet (member "vet" (ignore-errors
(process-lines go "tool")))))
(list
(flycheck-verification-result-new
:label "go tool vet"
:message (if have-vet "present" "missing")
:face (if have-vet 'success '(bold error)))))))
go-megacheck))

(flycheck-def-option-var flycheck-go-build-install-deps nil (go-build go-test)
"Whether to install dependencies in `go build' and `go test'.
Expand Down
4 changes: 2 additions & 2 deletions test/flycheck-test.el
Expand Up @@ -3329,8 +3329,8 @@ See https://github.com/flycheck/flycheck/issues/531 and Emacs bug #19206"))
(flycheck-ert-def-checker-test go-gofmt go syntax-error
(flycheck-ert-should-syntax-check
"language/go/src/syntax/syntax-error.go" 'go-mode
'(5 9 error "expected '(', found 'IDENT' ta" :checker go-gofmt)
'(6 1 error "expected ')', found '}'" :checker go-gofmt)))
'(5 9 error "expected '(', found ta" :checker go-gofmt)
'(6 1 error "expected declaration, found '}'" :checker go-gofmt)))

(flycheck-ert-def-checker-test (go-build go-golint go-vet) go complete-chain
(skip-unless (funcall (flycheck-checker-get 'go-vet 'predicate)))
Expand Down