avoid "any" as variable name
Avoid shadowing / confusion with Go's "any" built-in type. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -142,12 +142,12 @@ func (c *criService) updateContainerResources(ctx context.Context,
|
||||
|
||||
// updateContainerSpec updates container spec.
|
||||
func updateContainerSpec(ctx context.Context, cntr containerd.Container, spec *runtimespec.Spec) error {
|
||||
any, err := typeurl.MarshalAny(spec)
|
||||
s, err := typeurl.MarshalAny(spec)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal spec %+v: %w", spec, err)
|
||||
}
|
||||
if err := cntr.Update(ctx, func(ctx gocontext.Context, client *containerd.Client, c *containers.Container) error {
|
||||
c.Spec = any
|
||||
c.Spec = s
|
||||
return nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to update container spec: %w", err)
|
||||
|
||||
@@ -282,9 +282,9 @@ func (em *eventMonitor) start() <-chan error {
|
||||
ids := em.backOff.getExpiredIDs()
|
||||
for _, id := range ids {
|
||||
queue := em.backOff.deBackOff(id)
|
||||
for i, any := range queue.events {
|
||||
if err := em.handleEvent(any); err != nil {
|
||||
logrus.WithError(err).Errorf("Failed to handle backOff event %+v for %s", any, id)
|
||||
for i, evt := range queue.events {
|
||||
if err := em.handleEvent(evt); err != nil {
|
||||
logrus.WithError(err).Errorf("Failed to handle backOff event %+v for %s", evt, id)
|
||||
em.backOff.reBackOff(id, queue.events[i:], queue.duration)
|
||||
break
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ func TestBackOff(t *testing.T) {
|
||||
t.Logf("Should be able to check if the container is in backOff state")
|
||||
for k, queue := range inputQueues {
|
||||
for _, e := range queue.events {
|
||||
any, err := typeurl.MarshalAny(e)
|
||||
evt, err := typeurl.MarshalAny(e)
|
||||
assert.NoError(t, err)
|
||||
key, _, err := convertEvent(any)
|
||||
key, _, err := convertEvent(evt)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, k, key)
|
||||
assert.Equal(t, actual.isInBackOff(key), true)
|
||||
|
||||
@@ -162,9 +162,9 @@ func TestTypeurlMarshalUnmarshalSandboxMeta(t *testing.T) {
|
||||
test.configChange(meta.Config)
|
||||
}
|
||||
|
||||
any, err := typeurl.MarshalAny(meta)
|
||||
md, err := typeurl.MarshalAny(meta)
|
||||
assert.NoError(t, err)
|
||||
data, err := typeurl.UnmarshalAny(any)
|
||||
data, err := typeurl.UnmarshalAny(md)
|
||||
assert.NoError(t, err)
|
||||
assert.IsType(t, &sandboxstore.Metadata{}, data)
|
||||
curMeta, ok := data.(*sandboxstore.Metadata)
|
||||
|
||||
Reference in New Issue
Block a user