You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: provider.go
    path of file: ./repos/dotenx/ao-api/oauth/provider
    
    the code of the file until where you have to start completion: package provider

import (
	"fmt"
	"os"
	"strings"

	"github.com/dotenx/goth"
	"github.com/dotenx/goth/providers/amazon"
	"github.com/dotenx/goth/providers/battlenet"
	"github.com/dotenx/goth/providers/bitbucket"
	"github.com/dotenx/goth/providers/box"
	"github.com/dotenx/goth/providers/dailymotion"
	"github.com/dotenx/goth/providers/deezer"
	"github.com/dotenx/goth/providers/digitalocean"
	"github.com/dotenx/goth/providers/discord"
	"github.com/dotenx/goth/providers/dropbox"
	"github.com/dotenx/goth/providers/eveonline"
	"github.com/dotenx/goth/providers/facebook"
	"github.com/dotenx/goth/providers/fitbit"
	"github.com/dotenx/goth/providers/github"
	"github.com/dotenx/goth/providers/gitlab"
	"github.com/dotenx/goth/providers/google"
	"github.com/dotenx/goth/providers/heroku"
	"github.com/dotenx/goth/providers/influxcloud"
	"github.com/dotenx/goth
    
func New(name string, secret, key *string, uri string, scopes ...string) (*goth.Provider, error) {
	var initfunction func(key, secret, cbUrl string, scopes ...string) goth.Provider
	if val, ok := ProviderNameInitializationMap[name]; !ok {
		return nil, fmt.Errorf("No such OAUTH provider %v", name)
	} else {
		initfunction = val
	}

	if uri == "" {
		return nil, fmt.Errorf("Invalid callback uri provided for OAUTH provider %v", name)
	}

	capped := strings.ToUpper(name)
	// check if secret is present, if not check for ENV var
	if secret == nil || *secret == "" {
		envVar := fmt.Sprintf("%v_SECRET", capped)
		envVarValue := os.Getenv(envVar)
		if envVarValue == "" {
			return nil, fmt.Errorf("No secret set for %v OAUTH provider in config and environment variable %v not set, cannot set up OAUTH for %v", name, envVar, name)
		}
		secret = &envVarValue
	}

	// check if key is present, if not check for ENV var
	if key == nil || *key == "" {
		envVar := fmt.Sprintf("%v_KEY", capped)
		envVarValue := os.Getenv(envVar)
		if envVarValue == "" {
			return nil, fmt.Errorf("No key set for %v OAUTH provider in config and environment variable %v not set, cannot set up OAUTH for %v", name, envVar, name)
		}
		key = &envVarValue
	}

	gothProvider := initfunction(*key, *secret, uri, scopes...)

	return &gothProvider, nil
}