Review in context of golangci-lint integration
Feel free to split in separate issues if needed.
@ghostiam, hi!
Thank you for linter. I deeply reviewed it.
-
Naming proposal –
protogolintis too general and conflicts with protolint and similar. If in the future will appear the new proto-related linter when we going to question – why is it not part of your linter? IMHO, better to narrow naming to specific functionality. In your case –protoaccess,protoderefchecker,protogetter,protodeferlint,protousegetter,protoshield,protonodirectread,protoreadguard(help me 🙂). Inspiration can be drawn from https://golangci-lint.run/usage/linters/
// want "proto field read without getter:"
What is purpose of : in the end?
Based on implementation looks like a bug / typo.
// want "proto field read without getter:" "proto field read without getter:" "proto field read without getter:" "proto field read without getter:"
IMHO, it is cool to merge the similar messages (example) or make it more informative (see below).
It is cool to make message more informative and without tautology, e.g.
// want "proto field `Embedded` read without getter"
// want "direct access to proto `Embedded` field" (golangci-lint appends linter name as prefix)
// want "direct access to `Embedded` field of proto type `proto.Test`"
(help me 🙂)
Great idea with different suggested fixes modes:
const (
StandaloneMode Mode = iota
GolangciLintMode
)
My respect!
You wrote
Requires: []*analysis.Analyzer{inspect.Analyzer},
but dont use this dependency.
You ignore linting for linter project (see check list). E.g. I see preallocation cases.
IMHO, try to avoid strings comparison like
return sct.Field(0).Type().String() == messageState
(but in this case I cannot suggest better approach)
Also, old projects uses github.com/golang/protobuf.
// If getter exists, use it.
In such cases it doesn't exist?
IMHO
func (c *Checker) Check
is not the best naming, it's more about suggested fixing, not checking itself.
or Checker type itself just does not match the letter S from SOLID.
In addition check looks over-engineered a lot.
I expected simple logic like:
- find
SelectorExpr - if not Getter then print warning and add suggest fix with simple ("Get"+value), or with help of
go/format.Node
Reporting linter errors via diagnostic doesn't look as common and nice practice
if err != nil {
pass.Report(analysis.Diagnostic{
Pos: n.Pos(),
End: n.End(),
Message: fmt.Sprintf("error: %v", err),
})
return nil
}
(@ldez knows better)
🙂
P.S. Run linter in k8s and look nice results and messages 👍 No panics.
Expand me
▶ protogolint ./...
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:125:25: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:126:25: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:283:20: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:284:23: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:285:33: proto field read without getter: "lbl.Name" should be "lbl.GetName()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:293:9: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:294:20: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:296:23: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:297:31: proto field read without getter: "lbl.Name" should be "lbl.GetName()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:297:56: proto field read without getter: "lbl.Value" should be "lbl.GetValue()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:310:9: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:313:20: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:314:39: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:315:42: proto field read without getter: "metric.Counter.Value" should be "metric.GetCounter().GetValue()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:315:66: proto field read without getter: "m.Counter.Value" should be "m.GetCounter().GetValue()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:317:23: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:336:20: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:337:10: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:338:23: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:339:27: proto field read without getter: "lbl.Name" should be "lbl.GetName()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:354:11: proto field read without getter: "mf.Name" should be "mf.GetName()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:355:11: proto field read without getter: "mf.Help" should be "mf.GetHelp()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:356:11: proto field read without getter: "mf.Type" should be "mf.GetType()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:357:37: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:358:20: proto field read without getter: "mf.Metric" should be "mf.GetMetric()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:366:39: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:367:21: proto field read without getter: "m.Label" should be "m.GetLabel()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:370:12: proto field read without getter: "m.Gauge" should be "m.GetGauge()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:371:14: proto field read without getter: "m.Counter" should be "m.GetCounter()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:372:14: proto field read without getter: "m.Summary" should be "m.GetSummary()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:373:14: proto field read without getter: "m.Untyped" should be "m.GetUntyped()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:374:16: proto field read without getter: "m.Histogram" should be "m.GetHistogram()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:375:18: proto field read without getter: "m.TimestampMs" should be "m.GetTimestampMs()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:381:11: proto field read without getter: "lp.Name" should be "lp.GetName()"
/tmp/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:382:12: proto field read without getter: "lp.Value" should be "lp.GetValue()"
/tmp/kubernetes/test/e2e/kubectl/kubectl.go:1080:18: proto field read without getter: "d.Definitions" should be "d.GetDefinitions()"
/tmp/kubernetes/test/e2e/kubectl/kubectl.go:1083:21: proto field read without getter: "d.Definitions.AdditionalProperties" should be "d.GetDefinitions().GetAdditionalProperties()"
/tmp/kubernetes/test/e2e/kubectl/kubectl.go:1084:19: proto field read without getter: "p.Value" should be "p.GetValue()"
/tmp/kubernetes/test/e2e/kubectl/kubectl.go:1087:29: proto field read without getter: "p.Value.VendorExtension" should be "p.GetValue().GetVendorExtension()"
/tmp/kubernetes/test/e2e/kubectl/kubectl.go:1090:11: proto field read without getter: "p.Value" should be "p.GetValue()"
/tmp/kubernetes/test/images/agnhost/grpc-health-checking/grpc-health-checking.go:69:5: proto field read without getter: "req.Service" should be "req.GetService()"
/tmp/kubernetes/test/integration/apiserver/tracing/tracing_test.go:943:6: proto field read without getter: "span.Name" should be "span.GetName()"
/tmp/kubernetes/test/integration/apiserver/tracing/tracing_test.go:952:77: proto field read without getter: "span.TraceId" should be "span.GetTraceId()"
/tmp/kubernetes/test/integration/apiserver/tracing/tracing_test.go:984:12: proto field read without getter: "event.Name" should be "event.GetName()"
/tmp/kubernetes/test/integration/controlplane/transformation/transformation_test.go:540:25: proto field read without getter: "mf.Name" should be "mf.GetName()"
/tmp/kubernetes/test/integration/controlplane/transformation/transformation_test.go:541:25: proto field read without getter: "mf.Name" should be "mf.GetName()"
But I am not sure about false positives.
Thank you very much for the review, I will make corrections as soon as possible.
-
Yes, you're right, it was a reference to "protolint", I think I'll change the name to "protogetter".
-
Since the
analysistestpackage tests the message with a mask, I tried to use most of the message prefix so as not to write the entire message. -
When there are several fixes on one line, the
analysistestpackage forces to write it this way in order to test an unusual use case.
That is, from this
test := many[0].Embedded.S == "" || t.Embedded.CustomMethod() == nil || t.S == "" || t.Embedded == nil
to this
test.go:54:10: proto field read without getter: "many[0].Embedded.S" should be "many[0].GetEmbedded().GetS()"
test.go:54:38: proto field read without getter: "t.Embedded.CustomMethod()" should be "t.GetEmbedded().CustomMethod()"
test.go:54:74: proto field read without getter: "t.S" should be "t.GetS()"
test.go:54:87: proto field read without getter: "t.Embedded" should be "t.GetEmbedded()"
will be obtained and if I leave only one want record the test will fail 😢
Maybe I did something wrong, but I didn't find another solution...
-
Yes, I thought about it, but I also think that the user should immediately see what the correction should look like so that it is easier for him to make changes.
-
This idea originally belongs to the author of the tagalign linter.
-
Oops.
-
Yes, I haven't configured it in CI, but locally I use a very strict config, it doesn't report anything like that...
...
- Yes, this is not the best solution, but this solution helped me quickly fix bugs, since in this case it will be indicated why exactly the error occurred and the user will be able to send a piece of his code so that I can fix the error. What other way is there to report a linter error without printing directly to stderr?
In theory, if there is a false positive, then it will be in some unusual cases, since only fields that have a field with the MessageState type in their structure are checked (this is exactly the comparison that you talked about in 8).
@Antonboom if you have the opportunity, could you review it again?
1 - Renamed to protogetter
4 - Now the messages look like this:
avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
avoid direct access to proto field "m.Label" use "m.GetLabel()"
6 - Fixed.
8 - Fixed and also added new checks that did not pass in k8s.
9 - I added a detailed comment and found a place for optimization.
10 - Fixed?
k8s results
protogetter ./...
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:125:25: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:126:25: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:283:20: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:284:23: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:285:33: avoid direct access to proto field "lbl.Name" use "lbl.GetName()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:293:9: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:294:20: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:296:23: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:297:31: avoid direct access to proto field "lbl.Name" use "lbl.GetName()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:297:56: avoid direct access to proto field "lbl.Value" use "lbl.GetValue()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:310:9: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:313:20: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:314:39: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:315:42: avoid direct access to proto field "metric.Counter.Value" use "metric.GetCounter().GetValue()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:315:66: avoid direct access to proto field "m.Counter.Value" use "m.GetCounter().GetValue()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:317:23: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:336:20: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:337:10: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:338:23: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:339:27: avoid direct access to proto field "lbl.Name" use "lbl.GetName()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:354:11: avoid direct access to proto field "mf.Name" use "mf.GetName()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:355:11: avoid direct access to proto field "mf.Help" use "mf.GetHelp()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:356:11: avoid direct access to proto field "mf.Type" use "mf.GetType()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:357:37: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:358:20: avoid direct access to proto field "mf.Metric" use "mf.GetMetric()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:366:39: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:367:21: avoid direct access to proto field "m.Label" use "m.GetLabel()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:370:12: avoid direct access to proto field "m.Gauge" use "m.GetGauge()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:371:14: avoid direct access to proto field "m.Counter" use "m.GetCounter()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:372:14: avoid direct access to proto field "m.Summary" use "m.GetSummary()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:373:14: avoid direct access to proto field "m.Untyped" use "m.GetUntyped()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:374:16: avoid direct access to proto field "m.Histogram" use "m.GetHistogram()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:375:18: avoid direct access to proto field "m.TimestampMs" use "m.GetTimestampMs()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:381:11: avoid direct access to proto field "lp.Name" use "lp.GetName()"
/kubernetes/cluster/images/etcd-version-monitor/etcd-version-monitor.go:382:12: avoid direct access to proto field "lp.Value" use "lp.GetValue()"
/kubernetes/pkg/volume/csi/csi_client.go:206:24: avoid direct access to proto field "topology.Segments" use "topology.GetSegments()"
/kubernetes/pkg/volume/csi/csi_client.go:355:42: avoid direct access to proto field "resp.CapacityBytes" use "resp.GetCapacityBytes()"
/kubernetes/pkg/volume/csi/csi_client.go:635:25: avoid direct access to proto field "resp.VolumeCondition.GetAbnormal()" use "resp.GetVolumeCondition().GetAbnormal()"
/kubernetes/pkg/volume/csi/csi_client.go:635:61: avoid direct access to proto field "resp.VolumeCondition.GetMessage()" use "resp.GetVolumeCondition().GetMessage()"
/kubernetes/pkg/volume/portworx/portworx_util.go:82:5: avoid direct access to proto field "spec.VolumeLabels" use "spec.GetVolumeLabels()"
/kubernetes/pkg/volume/portworx/portworx_util.go:106:20: avoid direct access to proto field "spec.VolumeLabels" use "spec.GetVolumeLabels()"
/kubernetes/pkg/volume/portworx/portworx_util.go:225:5: avoid direct access to proto field "vol.Spec.Size" use "vol.GetSpec().GetSize()"
/kubernetes/pkg/volume/portworx/portworx_util.go:227:57: avoid direct access to proto field "vol.Spec.Size" use "vol.GetSpec().GetSize()"
/kubernetes/pkg/volume/portworx/portworx_util.go:232:32: avoid direct access to proto field "vol.Locator" use "vol.GetLocator()"
/kubernetes/pkg/volume/portworx/portworx_util.go:232:45: avoid direct access to proto field "vol.Spec" use "vol.GetSpec()"
/kubernetes/pkg/volume/portworx/portworx_util.go:248:5: avoid direct access to proto field "updatedVol.Spec.Size" use "updatedVol.GetSpec().GetSize()"
/kubernetes/pkg/volume/portworx/portworx_util.go:248:28: avoid direct access to proto field "vol.Spec.Size" use "vol.GetSpec().GetSize()"
/kubernetes/pkg/volume/portworx/portworx_util.go:250:17: avoid direct access to proto field "vol.Spec.Size" use "vol.GetSpec().GetSize()"
/kubernetes/pkg/volume/portworx/portworx_util.go:250:32: avoid direct access to proto field "updatedVol.Spec.Size" use "updatedVol.GetSpec().GetSize()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:206:5: avoid direct access to proto field "req.VolumeCapability.GetBlock()" use "req.GetVolumeCapability().GetBlock()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:207:26: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:208:78: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:211:25: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:212:78: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:223:28: avoid direct access to proto field "req.GetVolumeCapability().GetMount().FsType" use "req.GetVolumeCapability().GetMount().GetFsType()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:224:32: avoid direct access to proto field "req.GetVolumeCapability().GetMount().MountFlags" use "req.GetVolumeCapability().GetMount().GetMountFlags()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:225:38: avoid direct access to proto field "req.GetVolumeCapability().GetMount().VolumeMountGroup" use "req.GetVolumeCapability().GetMount().GetVolumeMountGroup()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:246:22: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:247:66: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:277:29: avoid direct access to proto field "mounted.VolumeMountGroup" use "mounted.GetVolumeMountGroup()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:322:5: avoid direct access to proto field "req.GetCapacityRange().RequiredBytes" use "req.GetCapacityRange().GetRequiredBytes()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:329:18: avoid direct access to proto field "req.GetCapacityRange().RequiredBytes" use "req.GetCapacityRange().GetRequiredBytes()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:348:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:357:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:367:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:377:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:387:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/pkg/volume/csi/fake/fake_client.go:397:30: avoid direct access to proto field "resp.Capabilities" use "resp.GetCapabilities()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/cache/SnapshotCache.go:94:28: avoid direct access to proto field "vi.SnapshotCSI.SourceVolumeId" use "vi.SnapshotCSI.GetSourceVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:43:9: avoid direct access to proto field "req.Name" use "req.GetName()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:46:5: avoid direct access to proto field "req.VolumeCapabilities" use "req.GetVolumeCapabilities()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:51:34: avoid direct access to proto field "req.Name" use "req.GetName()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:63:11: avoid direct access to proto field "req.CapacityRange" use "req.GetCapacityRange()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:64:12: avoid direct access to proto field "cr.RequiredBytes" use "cr.GetRequiredBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:67:12: avoid direct access to proto field "cr.LimitBytes" use "cr.GetLimitBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:84:33: avoid direct access to proto field "req.Name" use "req.GetName()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:92:31: avoid direct access to proto field "req.Name" use "req.GetName()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:98:19: avoid direct access to proto field "req.Name" use "req.GetName()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:130:9: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:139:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:150:52: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:167:9: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:170:9: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:173:5: avoid direct access to proto field "req.VolumeCapability" use "req.GetVolumeCapability()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:177:5: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:178:91: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:188:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:190:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:196:26: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:199:15: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:202:16: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:243:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:245:15: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:269:9: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:272:12: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:278:5: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:279:97: avoid direct access to proto field "req.NodeId" use "req.GetNodeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:289:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:302:5: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:307:9: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:308:9: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:326:9: avoid direct access to proto field "req.VolumeCapabilities" use "req.GetVolumeCapabilities()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:327:51: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:329:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:331:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:361:29: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:365:45: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:404:19: avoid direct access to proto field "req.MaxEntries" use "req.GetMaxEntries()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:408:10: avoid direct access to proto field "req.StartingToken" use "req.GetStartingToken()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:636:9: avoid direct access to proto field "req.SnapshotId" use "req.GetSnapshotId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:645:41: avoid direct access to proto field "req.SnapshotId" use "req.GetSnapshotId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:654:56: avoid direct access to proto field "req.SnapshotId" use "req.GetSnapshotId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:687:9: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:691:5: avoid direct access to proto field "req.CapacityRange" use "req.GetCapacityRange()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:702:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:704:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:711:18: avoid direct access to proto field "req.CapacityRange.RequiredBytes" use "req.GetCapacityRange().GetRequiredBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:713:5: avoid direct access to proto field "v.CapacityBytes" use "v.GetCapacityBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:723:5: avoid direct access to proto field "v.CapacityBytes" use "v.GetCapacityBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:724:106: avoid direct access to proto field "v.CapacityBytes" use "v.GetCapacityBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:724:135: avoid direct access to proto field "v.VolumeId" use "v.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:765:61: avoid direct access to proto field "req.SourceVolumeId" use "req.GetSourceVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:789:19: avoid direct access to proto field "req.MaxEntries" use "req.GetMaxEntries()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/controller.go:793:10: avoid direct access to proto field "req.StartingToken" use "req.GetStartingToken()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:37:16: avoid direct access to proto field "req.PublishContext" use "req.GetPublishContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:60:39: avoid direct access to proto field "req.StagingTargetPath" use "req.GetStagingTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:65:74: avoid direct access to proto field "req.StagingTargetPath" use "req.GetStagingTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:71:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:73:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:78:40: avoid direct access to proto field "req.StagingTargetPath" use "req.GetStagingTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:81:5: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:114:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:116:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:121:40: avoid direct access to proto field "req.StagingTargetPath" use "req.GetStagingTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:124:5: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:129:9: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:147:16: avoid direct access to proto field "req.PublishContext" use "req.GetPublishContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:172:39: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:177:62: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:183:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:185:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:188:49: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:193:40: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:196:5: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:200:6: avoid direct access to proto field "req.Readonly" use "req.GetReadonly()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:201:50: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:209:15: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:220:32: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:221:82: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:256:33: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:257:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:259:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:263:23: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:267:41: avoid direct access to proto field "req.TargetPath" use "req.GetTargetPath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:270:6: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:275:32: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:281:10: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:305:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:307:44: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:314:21: avoid direct access to proto field "req.CapacityRange.GetRequiredBytes()" use "req.GetCapacityRange().GetRequiredBytes()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:431:32: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:435:45: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:438:40: avoid direct access to proto field "req.VolumePath" use "req.GetVolumePath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:440:15: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:442:76: avoid direct access to proto field "req.VolumeId" use "req.GetVolumeId()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/node.go:442:90: avoid direct access to proto field "req.VolumePath" use "req.GetVolumePath()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/service.go:234:16: avoid direct access to proto field "vi.VolumeContext" use "vi.GetVolumeContext()"
/kubernetes/test/e2e/storage/drivers/csi-test/mock/service/service.go:274:16: avoid direct access to proto field "v.VolumeContext" use "v.GetVolumeContext()"
/kubernetes/test/e2e/kubectl/kubectl.go:1080:18: avoid direct access to proto field "d.Definitions" use "d.GetDefinitions()"
/kubernetes/test/e2e/kubectl/kubectl.go:1083:21: avoid direct access to proto field "d.Definitions.AdditionalProperties" use "d.GetDefinitions().GetAdditionalProperties()"
/kubernetes/test/e2e/kubectl/kubectl.go:1084:19: avoid direct access to proto field "p.Value" use "p.GetValue()"
/kubernetes/test/e2e/kubectl/kubectl.go:1087:29: avoid direct access to proto field "p.Value.VendorExtension" use "p.GetValue().GetVendorExtension()"
/kubernetes/test/e2e/kubectl/kubectl.go:1090:11: avoid direct access to proto field "p.Value" use "p.GetValue()"
/kubernetes/test/e2e/storage/csi_mock/base.go:762:26: avoid direct access to proto field "mountVolume.VolumeMountGroup" use "mountVolume.GetVolumeMountGroup()"
/kubernetes/test/e2e/storage/csi_mock/base.go:769:28: avoid direct access to proto field "mountVolume.VolumeMountGroup" use "mountVolume.GetVolumeMountGroup()"
/kubernetes/test/e2e/storage/csi_mock/base.go:863:28: avoid direct access to proto field "mountVolume.MountFlags" use "mountVolume.GetMountFlags()"
/kubernetes/test/e2e/storage/csi_mock/base.go:869:30: avoid direct access to proto field "mountVolume.MountFlags" use "mountVolume.GetMountFlags()"
/kubernetes/test/e2e/storage/csi_mock/csi_volume_expansion.go:592:21: avoid direct access to proto field "expansionRequest.StagingTargetPath" use "expansionRequest.GetStagingTargetPath()"
/kubernetes/test/e2e/storage/csi_mock/csi_volume_expansion.go:601:44: avoid direct access to proto field "expansionRequest.CapacityRange.RequiredBytes" use "expansionRequest.GetCapacityRange().GetRequiredBytes()"
/kubernetes/test/e2e/storage/csi_mock/csi_volume_expansion.go:609:44: avoid direct access to proto field "expansionRequest.CapacityRange.RequiredBytes" use "expansionRequest.GetCapacityRange().GetRequiredBytes()"
/kubernetes/test/images/agnhost/grpc-health-checking/grpc-health-checking.go:69:5: avoid direct access to proto field "req.Service" use "req.GetService()"
/kubernetes/pkg/volume/csi/csi_client_test.go:91:24: avoid direct access to proto field "topology.Segments" use "topology.GetSegments()"
/kubernetes/pkg/volume/csi/csi_client_test.go:123:24: avoid direct access to proto field "resp.VolumeCondition.GetAbnormal()" use "resp.GetVolumeCondition().GetAbnormal()"
/kubernetes/pkg/volume/csi/csi_client_test.go:123:60: avoid direct access to proto field "resp.VolumeCondition.GetMessage()" use "resp.GetVolumeCondition().GetMessage()"
/kubernetes/pkg/volume/csi/csi_client_test.go:335:42: avoid direct access to proto field "resp.CapacityBytes" use "resp.GetCapacityBytes()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:65:25: avoid direct access to proto field "expectedMetrics.Usage" use "expectedMetrics.GetUsage()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:66:7: avoid direct access to proto field "usage.Unit" use "usage.GetUnit()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:67:44: avoid direct access to proto field "usage.Available" use "usage.GetAvailable()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:68:40: avoid direct access to proto field "usage.Total" use "usage.GetTotal()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:69:39: avoid direct access to proto field "usage.Used" use "usage.GetUsed()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:81:7: avoid direct access to proto field "usage.Unit" use "usage.GetUnit()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:82:40: avoid direct access to proto field "usage.Available" use "usage.GetAvailable()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:83:36: avoid direct access to proto field "usage.Total" use "usage.GetTotal()"
/kubernetes/pkg/volume/csi/csi_metrics_test.go:84:40: avoid direct access to proto field "usage.Used" use "usage.GetUsed()"
/kubernetes/test/integration/apiserver/tracing/tracing_test.go:943:6: avoid direct access to proto field "span.Name" use "span.GetName()"
/kubernetes/test/integration/apiserver/tracing/tracing_test.go:952:77: avoid direct access to proto field "span.TraceId" use "span.GetTraceId()"
/kubernetes/test/integration/apiserver/tracing/tracing_test.go:984:12: avoid direct access to proto field "event.Name" use "event.GetName()"
/kubernetes/test/integration/controlplane/transformation/kms_transformation_test.go:178:33: avoid direct access to proto field "decryptResponse.Plain" use "decryptResponse.GetPlain()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:106:18: avoid direct access to proto field "o.EncryptedDEKSourceType" use "o.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:110:19: avoid direct access to proto field "o.EncryptedDEKSourceType" use "o.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:114:9: avoid direct access to proto field "o.EncryptedDEKSource" use "o.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:131:9: avoid direct access to proto field "o.EncryptedData" use "o.GetEncryptedData()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:292:39: avoid direct access to proto field "decryptResponse.Plaintext" use "decryptResponse.GetPlaintext()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:391:30: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:393:7: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:394:62: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:399:30: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:401:7: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:402:62: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:459:11: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:463:19: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:467:7: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:468:62: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:473:11: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:477:19: avoid direct access to proto field "obj.EncryptedDEKSource" use "obj.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:481:7: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:482:62: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:609:8: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:610:63: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:626:8: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:627:63: avoid direct access to proto field "obj.KeyID" use "obj.GetKeyID()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:726:11: avoid direct access to proto field "out[i].EncryptedData" use "out[i].GetEncryptedData()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:727:12: avoid direct access to proto field "out[i].EncryptedData" use "out[i].GetEncryptedData()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:748:34: avoid direct access to proto field "object.EncryptedDEKSource" use "object.GetEncryptedDEKSource()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:750:7: avoid direct access to proto field "object.EncryptedDEKSourceType" use "object.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:751:34: avoid direct access to proto field "object.EncryptedDEKSourceType" use "object.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:754:7: avoid direct access to proto field "object.EncryptedDEKSourceType" use "object.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:755:34: avoid direct access to proto field "object.EncryptedDEKSourceType" use "object.GetEncryptedDEKSourceType()"
/kubernetes/test/integration/controlplane/transformation/kmsv2_transformation_test.go:975:33: avoid direct access to proto field "decryptResponse.Plaintext" use "decryptResponse.GetPlaintext()"
/kubernetes/test/integration/controlplane/transformation/transformation_test.go:540:25: avoid direct access to proto field "mf.Name" use "mf.GetName()"
/kubernetes/test/integration/controlplane/transformation/transformation_test.go:541:25: avoid direct access to proto field "mf.Name" use "mf.GetName()"
@ghostiam, thank u for work!
Checklist:
- [x] Run at large project
- [x] Renaming
- [x] More clear message
- [x] critical No mask in tests – covered by #2
- [ ] critical Do not report error as diagnostic (see option below) – covered by #2
- [x] critical Do not ignore all generated files – covered by #2
- [ ] Code simple and robust as possible – covered by #2
- [ ] critical Linting presents in the project (CI and/or committed
.golangci.yml)
Also, some my thoughts.
- isProtoMessage became much better. I suggest pay attention to https://pkg.go.dev/go/types#Implements.
- Instead of reporting errors as diagnostic, you could return error in
Run, look at signature:Run: func(pass *analysis.Pass) (any, error). - You write a lot of tests and it's cool, but try to review all conditions and edge cases again, e.g.
- you use only
tmessage, try different naming (to test diagnostic) - what about combinations of other unary expressions?
- what about v1 proto message (you add support but without test)?
- ...
- Sometimes getters is useless, e.g. in cases when message 100% filled, as in argument of gRPC method:
Call(context.Context, *Test) (*Test, error)
But I'm not sure we need to check it, or need to configure to ignore such cases. It looks like consistency for the entire project is good anyway. And for everything else we have //nolint.
👌
1 - We can't use https://pkg.go.dev/go/types#Implements because it would make us depend on google.golang.org/protobuf, which would also force golangci-lint to do the same.
3 -
- I'm not only using the
tvariable, but in any case, the name of the variable doesn't change anything, since we're using AST. - I think we can add tests for other unary operators, but as far as I know, they will not have problems when receiving a value through a method, unlike
&. - I have studied, for the linter there are no differences between versions v1 and v2, they do not affect the logic in any way. The only differences are in private or specific proto fields, which do not matter to us.
- I'm afraid that I physically won't be able to describe all possible cases in tests :)
4 - The linter will ignore this case anyway, since access to fields is not used there. Also, gRPC allows you not to fill out the entire message, you can send it empty.