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: flag unkeyed struct literals when a struct has two fields of the same type #9421

Open
josharian opened this Issue Dec 22, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@josharian
Contributor

josharian commented Dec 22, 2014

Suggested in #9409.

Note that vet already flags all unkeyed composite struct literals when the type comes from a different package. This would extend checks to same-package types, but with more stringent criteria.

@bradfitz @alandonovan @shurcooL

@bradfitz

This comment has been minimized.

Member

bradfitz commented Dec 22, 2014

From @alandonovan in the other thread:

Perhaps we should also consider the case when field value in a literal is *assignable* to more than one field. This is a much larger set. For example:
type T struct { uint; int; float64 }
var _ = T{0, 1, 2}

@mikioh mikioh changed the title from tools/cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type to cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type Jan 4, 2015

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title from cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type to x/tools/cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type Apr 14, 2015

@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015

@rsc rsc removed the repo-tools label Apr 14, 2015

@mvdan mvdan changed the title from x/tools/cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type to cmd/vet: flag unkeyed struct literals when a struct has two fields of the same type May 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment