From 42e029cabc8f40c9239a368572473c6ff5c5d9d8 Mon Sep 17 00:00:00 2001 From: cormick Date: Wed, 16 Oct 2024 10:37:17 +0800 Subject: [PATCH] chore: remove unreachable code and fmt files Signed-off-by: cormick --- examples/go.mod | 8 +++++--- examples/go.sum | 3 +++ pkg/api/update.go | 2 +- plugins/device-injector/device-injector.go | 6 ------ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/go.mod b/examples/go.mod index 9bc021d8..6e76b084 100644 --- a/examples/go.mod +++ b/examples/go.mod @@ -1,12 +1,14 @@ module github.com/containerd/nri/examples -go 1.18 +go 1.21 + +toolchain go1.22.0 require ( github.com/containerd/cgroups v1.0.3 github.com/containerd/nri v0.1.0 github.com/opencontainers/runtime-spec v1.0.3-0.20220825212826-86290f6a00fb - github.com/sirupsen/logrus v1.8.1 + github.com/sirupsen/logrus v1.9.3 ) require ( @@ -14,7 +16,7 @@ require ( github.com/docker/go-units v0.4.0 // indirect github.com/godbus/dbus/v5 v5.0.4 // indirect github.com/gogo/protobuf v1.3.2 // indirect - golang.org/x/sys v0.13.0 // indirect + golang.org/x/sys v0.21.0 // indirect ) replace github.com/containerd/nri => ../ diff --git a/examples/go.sum b/examples/go.sum index 0f1c7a57..3f74acd1 100644 --- a/examples/go.sum +++ b/examples/go.sum @@ -32,6 +32,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -66,8 +67,10 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/pkg/api/update.go b/pkg/api/update.go index 04ac3925..3edf21db 100644 --- a/pkg/api/update.go +++ b/pkg/api/update.go @@ -16,7 +16,7 @@ package api -//nolint +// nolint // SetContainerId sets the id of the container to update. func (u *ContainerUpdate) SetContainerId(id string) { u.ContainerId = id diff --git a/plugins/device-injector/device-injector.go b/plugins/device-injector/device-injector.go index c355e965..a92aa1a9 100644 --- a/plugins/device-injector/device-injector.go +++ b/plugins/device-injector/device-injector.go @@ -88,8 +88,6 @@ func (p *plugin) CreateContainer(_ context.Context, pod *api.PodSandbox, ctr *ap return nil, nil, err } - return adjust, nil, nil - if verbose { dump(containerName(pod, ctr), "ContainerAdjustment", adjust) } @@ -132,10 +130,6 @@ func parseDevices(ctr string, annotations map[string]string) ([]device, error) { return nil, nil } - if annotation == nil { - return nil, nil - } - if err := yaml.Unmarshal(annotation, &devices); err != nil { return nil, fmt.Errorf("invalid device annotation %q: %w", string(annotation), err) }