Add nolint:staticcheck to platform-specific calls
The linter on platforms that have a hardcoded response complains about "if xyz == nil" checks; ignore those. Signed-off-by: Phil Estes <estesp@amazon.com>
This commit is contained in:
parent
c568752335
commit
ee49c4d557
@ -41,7 +41,7 @@ func (c *criService) ContainerStats(ctx context.Context, in *runtime.ContainerSt
|
||||
}
|
||||
|
||||
cs, err := c.containerMetrics(cntr.Metadata, resp.Metrics[0])
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented)
|
||||
return nil, fmt.Errorf("failed to decode container metrics: %w", err)
|
||||
}
|
||||
return &runtime.ContainerStatsResponse{Stats: cs}, nil
|
||||
|
@ -58,7 +58,7 @@ func (c *criService) toCRIContainerStats(
|
||||
containerStats := new(runtime.ListContainerStatsResponse)
|
||||
for _, cntr := range containers {
|
||||
cs, err := c.containerMetrics(cntr.Metadata, statsMap[cntr.ID])
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented)
|
||||
return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err)
|
||||
}
|
||||
containerStats.Stats = append(containerStats.Stats, cs)
|
||||
|
@ -34,13 +34,12 @@ func (c *criService) PodSandboxStats(
|
||||
}
|
||||
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
|
||||
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
|
@ -34,13 +34,12 @@ func (c *criService) ListPodSandboxStats(
|
||||
podSandboxStats := new(runtime.ListPodSandboxStatsResponse)
|
||||
for _, sandbox := range sandboxes {
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
return nil, fmt.Errorf("failed to obtain metrics for sandbox %q: %w", sandbox.ID, err)
|
||||
}
|
||||
|
||||
sandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
|
||||
if err != nil {
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)
|
||||
}
|
||||
podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats)
|
||||
|
Loading…
Reference in New Issue
Block a user