You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varerrUnexpectedInitializerType=errors.New("expected namingconventions.Initializer() to be of type initializer.ConfigurableAnalyzerInitializer, but was not")
34
+
35
+
funcnewAnalyzer() *analysis.Analyzer {
36
+
cfg:=&namingconventions.Config{
37
+
Conventions: []namingconventions.Convention{
38
+
{
39
+
Name: "nophase",
40
+
ViolationMatcher: "(?i)phase",
41
+
Operation: namingconventions.OperationInform,
42
+
Message: "phase fields are deprecated and conditions should be preferred, avoid phase like enum fields",
Copy file name to clipboardExpand all lines: pkg/analysis/nophase/testdata/src/a/a.go
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,18 @@ package a
2
2
3
3
typeNoPhaseTestStructstruct {
4
4
// +optional
5
-
Phase*string`json:"phase,omitempty"`// want "field Phase: phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
6
-
5
+
Phase*string`json:"phase,omitempty"`// want "naming convention \"nophase\": phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
7
6
}
8
7
9
8
// DoNothing is used to check that the analyser doesn't report on methods.
10
9
func (NoPhaseTestStruct) DoNothing() {}
11
10
12
11
typeNoSubPhaseTestStructstruct {
13
12
// +optional
14
-
FooPhase*string`json:"fooPhase,omitempty"`// want "field FooPhase: phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
15
-
13
+
FooPhase*string`json:"fooPhase,omitempty"`// want "naming convention \"nophase\": phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
16
14
}
17
15
18
16
typeSerializedPhaseTeststructstruct {
19
17
// +optional
20
-
FooField*string`json:"fooPhase,omitempty"`// want "field FooField: phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
21
-
18
+
FooField*string`json:"fooPhase,omitempty"`// want "naming convention \"nophase\": phase fields are deprecated and conditions should be preferred, avoid phase like enum fields"
0 commit comments