File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,23 @@ func isInPassPackage(pass *analysis.Pass, namedType *types.Named) bool {
122
122
// TypeAwareMarkerCollectionForField collects the markers for a given field into a single markers.MarkerSet.
123
123
// If the field has a type that is not a basic type (i.e a custom type) then it will also gather any markers from
124
124
// the type and include them in the markers.MarkerSet that is returned.
125
+ // It will look through *ast.StarExpr to the underlying type.
125
126
// Markers on the type will always come before markers on the field in the list of markers for an identifier.
126
127
func TypeAwareMarkerCollectionForField (pass * analysis.Pass , markersAccess markers.Markers , field * ast.Field ) markers.MarkerSet {
127
128
markers := markersAccess .FieldMarkers (field )
128
129
129
- ident , ok := field .Type .(* ast.Ident )
130
+ var underlyingType ast.Expr
131
+
132
+ switch t := field .Type .(type ) {
133
+ case * ast.Ident :
134
+ underlyingType = t
135
+ case * ast.StarExpr :
136
+ underlyingType = t .X
137
+ default :
138
+ return markers
139
+ }
140
+
141
+ ident , ok := underlyingType .(* ast.Ident )
130
142
if ! ok {
131
143
return markers
132
144
}
You can’t perform that action at this time.
0 commit comments