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

Closed
surajbarkale opened this issue Jul 25, 2018 · 4 comments
Closed

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

surajbarkale opened this issue Jul 25, 2018 · 4 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@surajbarkale
Copy link

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

go1.11beta2

Does this issue reproduce with the latest release?

Yes

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

darwin/amd64

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


Flags:
  -V	print version and exit
  -all
    	enable all non-experimental checks
  -asmdecl
    	check assembly against Go declarations
  -assign
    	check for useless assignments
  -atomic
    	check for common mistaken usages of the sync/atomic package
  -bool
    	check for mistakes involving boolean operators
  -buildtags
    	check that +build tags are valid
  -cgocall
    	check for types that may not be passed to cgo calls
  -composites
    	check that composite literals of types from imported packages use field-keyed elements
  -compositewhitelist
    	use composite white list; for testing only (default true)
  -copylocks
    	check that locks are not passed by value
  -httpresponse
    	check errors are checked before using an http Response
  -lostcancel
    	check for failure to call cancelation function returned by context.WithCancel
  -methods
    	check that canonically named methods are canonically defined
  -nilfunc
    	check for comparisons between functions and nil
  -printf
    	check printf-like invocations
  -printfuncs string
    	comma-separated list of print function names to check
  -rangeloops
    	check that loop variables are used correctly
  -shadow
    	check for shadowed variables (experimental; must be set explicitly)
  -shadowstrict
    	whether to be strict about shadowing; can be noisy
  -shift
    	check for useless shifts
  -source
    	import from source instead of compiled object files
  -structtags
    	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
  -tests
    	check for common mistaken usages of tests/documentation examples
  -unreachable
    	check for unreachable code
  -unsafeptr
    	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")
  -unusedresult
    	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
@oiooj
Copy link
Member

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 Feedback is required from experts, contributors, and/or the community before a change can be made. label Jul 25, 2018
@mvdan mvdan added this to the Go1.11 milestone Jul 25, 2018
@mvdan
Copy link
Member

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.

@rsc
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Jul 26, 2018
@gopherbot
Copy link

Change https://golang.org/cl/126696 mentions this issue: cmd/go: replace -getmode with -mod, $GOPROXY

@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.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants