'cannot use &cfg (value of type *aws.Config) as *aws.Config value in argument to session.NewSession

I'm trying to get a new AWS Session like this:

cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
    log.Fatal(err)
}

awsSession, err := session.NewSession(&cfg)
if err != nil {
    log.Fatal(err)
}

But I get a confusing (at least to me) error:

cannot use &cfg (value of type *aws.Config) as *aws.Config value in argument to session.NewSession

The signature of NewSession() looks like this:

func NewSession(cfgs ...*aws.Config) (*Session, error)

Does the fact that NewSession() is a variadic function play any role in producing this error?

Why does the error go away if I pass a literal aws.Config{} like this?

awsSession, err := session.NewSession(&aws.Config{})


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source