Remove deprecated function calls flagged by staticcheck (#3333)
* Use session.NewSession instead of session.New Signed-off-by: Erfan Besharat <erbesharat@gmail.com> * Use grpc.DialContext instead of grpc.WithTimeout Signed-off-by: Erfan Besharat <erbesharat@gmail.com> * Pass non-nil context to context.WithTimeout Signed-off-by: Erfan Besharat <erbesharat@gmail.com> * Return the error directly in route53 setup Co-Authored-By: Miek Gieben <miek@miek.nl> Signed-off-by: Erfan Besharat <erbesharat@gmail.com>
This commit is contained in:
parent
dbd1c047cb
commit
4ffbee299a
2 changed files with 9 additions and 2 deletions
|
@ -120,8 +120,14 @@ func setup(c *caddy.Controller, f func(*credentials.Credentials) route53iface.Ro
|
|||
return plugin.Error("route53", c.Errf("unknown property '%s'", c.Val()))
|
||||
}
|
||||
}
|
||||
|
||||
session, err := session.NewSession(&aws.Config{})
|
||||
if err != nil {
|
||||
return plugin.Error("route53", err)
|
||||
}
|
||||
|
||||
providers = append(providers, &credentials.EnvProvider{}, sharedProvider, &ec2rolecreds.EC2RoleProvider{
|
||||
Client: ec2metadata.New(session.New(&aws.Config{})),
|
||||
Client: ec2metadata.New(session),
|
||||
})
|
||||
client := f(credentials.NewChainCredentials(providers))
|
||||
ctx := context.Background()
|
||||
|
|
|
@ -22,7 +22,8 @@ func TestGrpc(t *testing.T) {
|
|||
}
|
||||
defer g.Stop()
|
||||
|
||||
conn, err := grpc.Dial(tcp, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second))
|
||||
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
conn, err := grpc.DialContext(ctx, tcp, grpc.WithInsecure(), grpc.WithBlock())
|
||||
if err != nil {
|
||||
t.Fatalf("Expected no error but got: %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue