|
1 | 1 | package a |
2 | 2 |
|
3 | 3 | type ( |
4 | | - MapStringComponent map[string]Component |
5 | | - PtrMapStringComponent *map[string]Component |
6 | | - MapStringInt map[string]int |
7 | | - MapIntString map[int]string |
| 4 | + MapStringComponent map[string]Component // want "type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
| 5 | + PtrMapStringComponent *map[string]Component // want "type PtrMapStringComponent pointer should not use a map type, use a list type with a unique name/identifier instead" |
| 6 | + MapStringInt map[string]int // want "type MapStringInt should not use a map type, use a list type with a unique name/identifier instead" |
| 7 | + MapIntString map[int]string // want "type MapIntString should not use a map type, use a list type with a unique name/identifier instead" |
8 | 8 | ) |
9 | 9 |
|
10 | 10 | type ( |
11 | | - MapStringComponentAlias = map[string]Component |
12 | | - MapStringPtrComponentAlias = *map[string]Component |
13 | | - MapStringIntAlias = map[string]int |
14 | | - DefinedMapStringComponentAlias = MapStringComponent |
15 | | - DefinedMapStringComponentPtrAlias = *MapStringComponent |
| 11 | + MapStringComponentAlias = map[string]Component // want "type MapStringComponentAlias should not use a map type, use a list type with a unique name/identifier instead" |
| 12 | + MapStringPtrComponentAlias = *map[string]Component // want "type MapStringPtrComponentAlias pointer should not use a map type, use a list type with a unique name/identifier instead" |
| 13 | + MapStringIntAlias = map[string]int // want "type MapStringIntAlias should not use a map type, use a list type with a unique name/identifier instead" |
| 14 | + DefinedMapStringComponentAlias = MapStringComponent // want "type DefinedMapStringComponentAlias type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
| 15 | + DefinedMapStringComponentPtrAlias = *MapStringComponent // want "type DefinedMapStringComponentPtrAlias pointer type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
16 | 16 | ) |
17 | 17 |
|
18 | 18 | type ( |
19 | | - MapStringGenerics[V any] map[string]V |
20 | | - MapIntGenerics[V any] map[int]V |
21 | | - MapComparableKeyString[K comparable] map[K]string |
22 | | - MapComparableKeyInt[K comparable] map[K]int |
| 19 | + MapStringGenerics[V any] map[string]V // want "type MapStringGenerics should not use a map type, use a list type with a unique name/identifier instead" |
| 20 | + MapIntGenerics[V any] map[int]V // want "type MapIntGenerics should not use a map type, use a list type with a unique name/identifier instead" |
| 21 | + MapComparableKeyString[K comparable] map[K]string // want "type MapComparableKeyString should not use a map type, use a list type with a unique name/identifier instead" |
| 22 | + MapComparableKeyInt[K comparable] map[K]int // want "type MapComparableKeyInt should not use a map type, use a list type with a unique name/identifier instead" |
23 | 23 | ) |
24 | 24 |
|
25 | 25 | type NoMapsTestStruct struct { |
26 | 26 | Primitive int32 `json:"primitive"` |
27 | 27 | Components []Component `json:"components"` |
28 | 28 | MapComponents map[string]Component `json:"mapComponents"` // want "NoMapsTestStruct.MapComponents should not use a map type, use a list type with a unique name/identifier instead" |
29 | | - PtrMapComponents *map[string]Component `json:"ptrMapComponents"` // want "NoMapsTestStruct.PtrMapComponents should not use a map type, use a list type with a unique name/identifier instead" |
| 29 | + PtrMapComponents *map[string]Component `json:"ptrMapComponents"` // want "NoMapsTestStruct.PtrMapComponents pointer should not use a map type, use a list type with a unique name/identifier instead" |
30 | 30 | MapStringInt map[string]int `json:"mapStringInt"` // want "NoMapsTestStruct.MapStringInt should not use a map type, use a list type with a unique name/identifier instead" |
31 | 31 | Labels map[string]string `json:"specialCase"` |
32 | 32 | } |
33 | 33 |
|
34 | 34 | type NoMapsTestStructWithDefiningType struct { |
35 | | - MapStringComponent MapStringComponent `json:"mapStringComponent"` // want "NoMapsTestStructWithDefiningType.MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
36 | | - PtrMapStringComponent PtrMapStringComponent `json:"ptrMapStringComponent"` // want "NoMapsTestStructWithDefiningType.PtrMapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
37 | | - MapStringInt MapStringInt `json:"mapStringInt"` // want "NoMapsTestStructWithDefiningType.MapStringInt should not use a map type, use a list type with a unique name/identifier instead" |
38 | | - MapIntString MapIntString `json:"mapIntString"` // want "NoMapsTestStructWithDefiningType.MapIntString should not use a map type, use a list type with a unique name/identifier instead" |
| 35 | + MapStringComponent MapStringComponent `json:"mapStringComponent"` // want "NoMapsTestStructWithDefiningType.MapStringComponent type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
| 36 | + PtrMapStringComponent PtrMapStringComponent `json:"ptrMapStringComponent"` // want "NoMapsTestStructWithDefiningType.PtrMapStringComponent type PtrMapStringComponent pointer should not use a map type, use a list type with a unique name/identifier instead" |
| 37 | + MapStringInt MapStringInt `json:"mapStringInt"` // want "NoMapsTestStructWithDefiningType.MapStringInt type MapStringInt should not use a map type, use a list type with a unique name/identifier instead" |
| 38 | + MapIntString MapIntString `json:"mapIntString"` // want "NoMapsTestStructWithDefiningType.MapIntString type MapIntString should not use a map type, use a list type with a unique name/identifier instead" |
39 | 39 | } |
40 | 40 |
|
41 | 41 | type NoMapsTestStructWithDefiningTypeAcrossFiles struct { |
42 | | - MapStringComponent MapStringComponentB `json:"mapStringComponent"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
43 | | - PtrMapStringComponent PtrMapStringComponentB `json:"ptrMapStringComponent"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.PtrMapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
44 | | - MapStringInt MapStringIntB `json:"mapStringInt"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapStringInt should not use a map type, use a list type with a unique name/identifier instead" |
45 | | - MapIntString MapIntStringB `json:"mapIntString"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapIntString should not use a map type, use a list type with a unique name/identifier instead" |
| 42 | + MapStringComponent MapStringComponentB `json:"mapStringComponent"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapStringComponent type MapStringComponentB should not use a map type, use a list type with a unique name/identifier instead" |
| 43 | + PtrMapStringComponent PtrMapStringComponentB `json:"ptrMapStringComponent"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.PtrMapStringComponent type PtrMapStringComponentB pointer should not use a map type, use a list type with a unique name/identifier instead" |
| 44 | + MapStringInt MapStringIntB `json:"mapStringInt"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapStringInt type MapStringIntB should not use a map type, use a list type with a unique name/identifier instead" |
| 45 | + MapIntString MapIntStringB `json:"mapIntString"` // want "NoMapsTestStructWithDefiningTypeAcrossFiles.MapIntString type MapIntStringB should not use a map type, use a list type with a unique name/identifier instead" |
46 | 46 | } |
47 | 47 |
|
48 | 48 | type NoMapsTestStructWithAlias struct { |
49 | | - MapStringComponentAlias MapStringComponentAlias `json:"mapStringComponentAlias"` // want "NoMapsTestStructWithAlias.MapStringComponentAlias should not use a map type, use a list type with a unique name/identifier instead" |
50 | | - MapStringPtrComponentAlias MapStringPtrComponentAlias `json:"mapStringPtrComponentAlias"` // want "NoMapsTestStructWithAlias.MapStringPtrComponentAlias should not use a map type, use a list type with a unique name/identifier instead" |
51 | | - MapStringIntAlias MapStringIntAlias `json:"mapStringIntAlias"` // want "NoMapsTestStructWithAlias.MapStringIntAlias should not use a map type, use a list type with a unique name/identifier instead" |
52 | | - DefinedMapStringComponentAlias DefinedMapStringComponentAlias `json:"definedMapStringComponentAlias"` // want "NoMapsTestStructWithAlias.DefinedMapStringComponentAlias should not use a map type, use a list type with a unique name/identifier instead" |
53 | | - DefinedMapStringComponentPtrAlias DefinedMapStringComponentPtrAlias `json:"definedMapStringComponentPtrAlias"` // want "NoMapsTestStructWithAlias.DefinedMapStringComponentPtrAlias should not use a map type, use a list type with a unique name/identifier instead" |
| 49 | + MapStringComponentAlias MapStringComponentAlias `json:"mapStringComponentAlias"` // want "NoMapsTestStructWithAlias.MapStringComponentAlias type MapStringComponentAlias should not use a map type, use a list type with a unique name/identifier instead" |
| 50 | + MapStringPtrComponentAlias MapStringPtrComponentAlias `json:"mapStringPtrComponentAlias"` // want "NoMapsTestStructWithAlias.MapStringPtrComponentAlias type MapStringPtrComponentAlias pointer should not use a map type, use a list type with a unique name/identifier instead" |
| 51 | + MapStringIntAlias MapStringIntAlias `json:"mapStringIntAlias"` // want "NoMapsTestStructWithAlias.MapStringIntAlias type MapStringIntAlias should not use a map type, use a list type with a unique name/identifier instead" |
| 52 | + DefinedMapStringComponentAlias DefinedMapStringComponentAlias `json:"definedMapStringComponentAlias"` // want "NoMapsTestStructWithAlias.DefinedMapStringComponentAlias type DefinedMapStringComponentAlias type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
| 53 | + DefinedMapStringComponentPtrAlias DefinedMapStringComponentPtrAlias `json:"definedMapStringComponentPtrAlias"` // want "NoMapsTestStructWithAlias.DefinedMapStringComponentPtrAlias type DefinedMapStringComponentPtrAlias pointer type MapStringComponent should not use a map type, use a list type with a unique name/identifier instead" |
54 | 54 | } |
55 | 55 |
|
56 | 56 | type NoMapsTestStructWithGenerics[K comparable, V any] struct { |
57 | | - MapStringGenerics MapStringGenerics[V] `json:"mapStringGenerics"` // want "NoMapsTestStructWithGenerics.MapStringGenerics should not use a map type, use a list type with a unique name/identifier instead" |
58 | | - MapIntGenerics MapIntGenerics[V] `json:"mapIntGenerics"` // want "NoMapsTestStructWithGenerics.MapIntGenerics should not use a map type, use a list type with a unique name/identifier instead" |
59 | | - MapComparableKeyString MapComparableKeyString[K] `json:"mapComparableKeyString"` // want "NoMapsTestStructWithGenerics.MapComparableKeyString should not use a map type, use a list type with a unique name/identifier instead" |
60 | | - MapComparableKeyInt MapComparableKeyInt[K] `json:"mapComparableKeyInt"` // want "NoMapsTestStructWithGenerics.MapComparableKeyInt should not use a map type, use a list type with a unique name/identifier instead" |
| 57 | + MapStringGenerics MapStringGenerics[V] `json:"mapStringGenerics"` // want "NoMapsTestStructWithGenerics.MapStringGenerics type MapStringGenerics should not use a map type, use a list type with a unique name/identifier instead" |
| 58 | + MapIntGenerics MapIntGenerics[V] `json:"mapIntGenerics"` // want "NoMapsTestStructWithGenerics.MapIntGenerics type MapIntGenerics should not use a map type, use a list type with a unique name/identifier instead" |
| 59 | + MapComparableKeyString MapComparableKeyString[K] `json:"mapComparableKeyString"` // want "NoMapsTestStructWithGenerics.MapComparableKeyString type MapComparableKeyString should not use a map type, use a list type with a unique name/identifier instead" |
| 60 | + MapComparableKeyInt MapComparableKeyInt[K] `json:"mapComparableKeyInt"` // want "NoMapsTestStructWithGenerics.MapComparableKeyInt type MapComparableKeyInt should not use a map type, use a list type with a unique name/identifier instead" |
61 | 61 | } |
62 | 62 |
|
63 | 63 | type NoMapsTestStructWithEmbedded struct { |
|
0 commit comments