Merge pull request #7349 from thaJeztah/gofmt_119
clean-up "nolint" comments, remove unused ones, update golangci-lint
This commit is contained in:
@@ -83,7 +83,7 @@ func WithVolumes(volumeMounts map[string]string) containerd.NewContainerOpts {
|
||||
// if it fails but not RM snapshot data.
|
||||
// refer to https://github.com/containerd/containerd/pull/1868
|
||||
// https://github.com/containerd/containerd/pull/1785
|
||||
defer os.Remove(root) // nolint: errcheck
|
||||
defer os.Remove(root)
|
||||
|
||||
unmounter := func(mountPath string) {
|
||||
if uerr := mount.Unmount(mountPath, 0); uerr != nil {
|
||||
|
||||
@@ -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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented)
|
||||
if err != nil {
|
||||
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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err)
|
||||
}
|
||||
containerStats.Stats = append(containerStats.Stats, cs)
|
||||
|
||||
@@ -318,7 +318,7 @@ func (c *criService) getTLSConfig(registryTLSConfig criconfig.TLSConfig) (*tls.C
|
||||
if len(cert.Certificate) != 0 {
|
||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
}
|
||||
tlsConfig.BuildNameToCertificate() // nolint:staticcheck
|
||||
tlsConfig.BuildNameToCertificate() //nolint:staticcheck // TODO(thaJeztah): verify if we should ignore the deprecation; see https://github.com/containerd/containerd/pull/7349/files#r990644833
|
||||
}
|
||||
|
||||
if registryTLSConfig.CAFile != "" {
|
||||
|
||||
@@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats(
|
||||
}
|
||||
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats(
|
||||
podSandboxStats := new(runtime.ListPodSandboxStatsResponse)
|
||||
for _, sandbox := range sandboxes {
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)
|
||||
}
|
||||
podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats)
|
||||
|
||||
@@ -117,7 +117,7 @@ type criService struct {
|
||||
baseOCISpecs map[string]*oci.Spec
|
||||
// allCaps is the list of the capabilities.
|
||||
// When nil, parsed from CapEff of /proc/self/status.
|
||||
allCaps []string // nolint
|
||||
allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux
|
||||
// unpackDuplicationSuppressor is used to make sure that there is only
|
||||
// one in-flight fetch request or unpack handler for a given descriptor's
|
||||
// or chain ID.
|
||||
|
||||
@@ -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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (stats unimplemented)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode container metrics: %w", err)
|
||||
}
|
||||
return &runtime.ContainerStatsResponse{Stats: cs}, nil
|
||||
|
||||
@@ -61,7 +61,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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (metrics unimplemented)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode container metrics for %q: %w", cntr.ID, err)
|
||||
}
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ func (c *criService) getTLSConfig(registryTLSConfig criconfig.TLSConfig) (*tls.C
|
||||
if len(cert.Certificate) != 0 {
|
||||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
}
|
||||
tlsConfig.BuildNameToCertificate() // nolint:staticcheck
|
||||
tlsConfig.BuildNameToCertificate() //nolint:staticcheck // TODO(thaJeztah): verify if we should ignore the deprecation; see https://github.com/containerd/containerd/pull/7349/files#r990644833
|
||||
}
|
||||
|
||||
if registryTLSConfig.CAFile != "" {
|
||||
|
||||
@@ -34,12 +34,12 @@ func (c *criService) PodSandboxStats(
|
||||
}
|
||||
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed getting metrics for sandbox %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
podSandboxStats, err := c.podSandboxStats(ctx, sandbox, metrics)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode pod sandbox metrics %s: %w", r.GetPodSandboxId(), err)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ func (c *criService) ListPodSandboxStats(
|
||||
podSandboxStats := new(runtime.ListPodSandboxStatsResponse)
|
||||
for _, sandbox := range sandboxes {
|
||||
metrics, err := metricsForSandbox(sandbox)
|
||||
if err != nil { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
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 { //nolint:staticcheck // Ignore SA4023 as some platforms always return nil (unimplemented metrics)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to decode sandbox container metrics for sandbox %q: %w", sandbox.ID, err)
|
||||
}
|
||||
podSandboxStats.Stats = append(podSandboxStats.Stats, sandboxStats)
|
||||
|
||||
@@ -113,7 +113,7 @@ type criService struct {
|
||||
baseOCISpecs map[string]*oci.Spec
|
||||
// allCaps is the list of the capabilities.
|
||||
// When nil, parsed from CapEff of /proc/self/status.
|
||||
allCaps []string // nolint
|
||||
allCaps []string //nolint:nolintlint,unused // Ignore on non-Linux
|
||||
// unpackDuplicationSuppressor is used to make sure that there is only
|
||||
// one in-flight fetch request or unpack handler for a given descriptor's
|
||||
// or chain ID.
|
||||
|
||||
@@ -208,6 +208,6 @@ func (s *Store) Delete(id string) {
|
||||
c.IO.Close()
|
||||
}
|
||||
s.labels.Release(c.ProcessLabel)
|
||||
s.idIndex.Delete(id) // nolint: errcheck
|
||||
s.idIndex.Delete(id)
|
||||
delete(s.containers, id)
|
||||
}
|
||||
|
||||
@@ -28,10 +28,9 @@ import (
|
||||
// 2) Metadata is checkpointed as containerd container label.
|
||||
|
||||
// metadataVersion is current version of container metadata.
|
||||
const metadataVersion = "v1" // nolint
|
||||
const metadataVersion = "v1"
|
||||
|
||||
// versionedMetadata is the internal versioned container metadata.
|
||||
// nolint
|
||||
type versionedMetadata struct {
|
||||
// Version indicates the version of the versioned container metadata.
|
||||
Version string
|
||||
|
||||
@@ -61,10 +61,9 @@ import (
|
||||
// DELETED
|
||||
|
||||
// statusVersion is current version of container status.
|
||||
const statusVersion = "v1" // nolint
|
||||
const statusVersion = "v1"
|
||||
|
||||
// versionedStatus is the internal used versioned container status.
|
||||
// nolint
|
||||
type versionedStatus struct {
|
||||
// Version indicates the version of the versioned container status.
|
||||
Version string
|
||||
|
||||
@@ -246,6 +246,6 @@ func (s *store) delete(id, ref string) {
|
||||
return
|
||||
}
|
||||
// Remove the image if it is not referenced any more.
|
||||
s.digestSet.Remove(digest) // nolint: errcheck
|
||||
s.digestSet.Remove(digest)
|
||||
delete(s.images, digest.String())
|
||||
}
|
||||
|
||||
@@ -29,10 +29,9 @@ import (
|
||||
// 2) Metadata is checkpointed as containerd container label.
|
||||
|
||||
// metadataVersion is current version of sandbox metadata.
|
||||
const metadataVersion = "v1" // nolint
|
||||
const metadataVersion = "v1"
|
||||
|
||||
// versionedMetadata is the internal versioned sandbox metadata.
|
||||
// nolint
|
||||
type versionedMetadata struct {
|
||||
// Version indicates the version of the versioned sandbox metadata.
|
||||
Version string
|
||||
|
||||
@@ -160,6 +160,6 @@ func (s *Store) Delete(id string) {
|
||||
return
|
||||
}
|
||||
s.labels.Release(s.sandboxes[id].ProcessLabel)
|
||||
s.idIndex.Delete(id) // nolint: errcheck
|
||||
s.idIndex.Delete(id)
|
||||
delete(s.sandboxes, id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user