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: does not support -getmode flag #26586

surajbarkale opened this issue Jul 25, 2018 · 4 comments

cmd/vet: does not support -getmode flag #26586

surajbarkale opened this issue Jul 25, 2018 · 4 comments


Copy link

@surajbarkale surajbarkale commented Jul 25, 2018

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


Does this issue reproduce with the latest release?


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


What did you do?

  1. Execute go vet in a directory with valid go.mod
  2. Execute go vet -getmode=vendor in the same directory

What did you expect to see?

Both go vet invocations succeed

What did you see instead?

go vet -getmode=vendor prints following error message:

flag provided but not defined: -getmode
Usage of vet:
	vet [flags] directory...
	vet [flags] files... # Must be a single package
By default, -all is set and all non-experimental checks are run.
For more information run
	go doc cmd/vet

  -V	print version and exit
    	enable all non-experimental checks
    	check assembly against Go declarations
    	check for useless assignments
    	check for common mistaken usages of the sync/atomic package
    	check for mistakes involving boolean operators
    	check that +build tags are valid
    	check for types that may not be passed to cgo calls
    	check that composite literals of types from imported packages use field-keyed elements
    	use composite white list; for testing only (default true)
    	check that locks are not passed by value
    	check errors are checked before using an http Response
    	check for failure to call cancelation function returned by context.WithCancel
    	check that canonically named methods are canonically defined
    	check for comparisons between functions and nil
    	check printf-like invocations
  -printfuncs string
    	comma-separated list of print function names to check
    	check that loop variables are used correctly
    	check for shadowed variables (experimental; must be set explicitly)
    	whether to be strict about shadowing; can be noisy
    	check for useless shifts
    	import from source instead of compiled object files
    	check that struct field tags have canonical format and apply to exported fields as needed
  -tags string
    	space-separated list of build tags to apply when parsing
    	check for common mistaken usages of tests/documentation examples
    	check for unreachable code
    	check for misuse of unsafe.Pointer
  -unusedfuncs string
    	comma-separated list of functions whose results must be used (default "errors.New,fmt.Errorf,fmt.Sprintf,fmt.Sprint,sort.Reverse")
    	check for unused result of calls to functions in -unusedfuncs list and methods in -unusedstringmethods list
  -unusedstringmethods string
    	comma-separated list of names of methods of type func() string whose results must be used (default "Error,String")
  -v	verbose
@oiooj oiooj added the modules label Jul 25, 2018
Copy link

@oiooj oiooj commented Jul 25, 2018

go vet doesn't support -getmode flag now.

@mvdan mvdan changed the title go vet -getmode=vendor does not work cmd/vet: does not support -getmode flag Jul 25, 2018
@mvdan mvdan added the NeedsDecision label Jul 25, 2018
@mvdan mvdan added this to the Go1.11 milestone Jul 25, 2018
Copy link

@mvdan mvdan commented Jul 25, 2018

cc @bcmills @rsc

I guess the broader question is if all the tools that potentially run builds should have these module flags.

Copy link

@rsc rsc commented Jul 26, 2018

In general all the tools that load packages do have the -getmode flag - it's a build flag documented in 'go help build', and essentially all commands that take lists of packages as arguments also take build flags (the canonical one being -tags).

The difference here is that vet has its own special flag parser and I didn't realize it had its own list of what the build flags are. We just need to add the flag there. Possibly test too.

@bcmills bcmills added NeedsFix and removed NeedsDecision labels Jul 26, 2018
Copy link

@gopherbot gopherbot commented Jul 30, 2018

Change mentions this issue: cmd/go: replace -getmode with -mod, $GOPROXY

@gopherbot gopherbot closed this in 30a84b3 Aug 1, 2018
@golang golang locked and limited conversation to collaborators Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants