Description
I propose we relax the "composites" vet check to allow implicit field name use if the struct literal and struct type are within the same module.
Currently the "composites" vet check allows implicit struct field names if the struct type and struct literal are in the same package. When adding a new struct field you can certainly update uses in the same package and avoid errors. Now that modules provide a formal grouping of packages we can further relax the "composites" check to allow implicit field use within the same module because you similarly can update all struct uses throughout the module when adding a new struct field.
This came up when discussing whether gopls should suppress implicit field completions that would fail vet.
To implement this change the analyzer would need to be able to map a types.Package to a module name. I don't know exactly how this would work.
/cc @mvdan
Metadata
Metadata
Assignees
Type
Projects
Status