Skip to content

Commit

Permalink
fix golang-ci lint of meatada get with context
Browse files Browse the repository at this point in the history
Signed-off-by: Paco Xu <[email protected]>
  • Loading branch information
pacoxu committed Dec 16, 2024
1 parent 4e6c9c9 commit 51438f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/cloudinfo/gce/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package gce

import (
"context"
"os"
"strings"

Expand Down Expand Up @@ -48,7 +49,7 @@ func (provider) IsActiveProvider() bool {
}

func (provider) GetInstanceType() info.InstanceType {
machineType, err := metadata.Get("instance/machine-type")
machineType, err := metadata.GetWithContext(context.TODO(), "instance/machine-type")
if err != nil {
return info.UnknownInstance
}
Expand All @@ -58,7 +59,7 @@ func (provider) GetInstanceType() info.InstanceType {
}

func (provider) GetInstanceID() info.InstanceID {
instanceID, err := metadata.Get("instance/id")
instanceID, err := metadata.GetWithContext(context.TODO(), "instance/id")
if err != nil {
return info.UnknownInstance
}
Expand Down

0 comments on commit 51438f0

Please sign in to comment.