// NewContextNameFactory returns a new ContextNameFactory, preferring the format string in `$KUBECTL_GKE_CONTEXT_FORMAT`
// over the provided string.
NewContextNameFactory returns a new ContextNameFactory, preferring the format string in `$KUBECTL_GKE_CONTEXT_FORMAT`
over the provided string.
// NewContextNameFactory returns a new ContextNameFactory preferring the format string in ` $KUBECTL_GKE_CONTEXT_FORMAT ` // over the provided string .
func NewContextNameFactory(fallback string) (ContextNameFactory, error) {
	var format string
	if env, exists := os.LookupEnv("KUBECTL_GKE_CONTEXT_FORMAT"); exists {
		format = env
	} else if fallback == "" {
		format = GcloudDefaultFormat
	} else {
		format = fallback
	}
	t, err := template.New("context-name").Parse(format)
	if err != nil {
		return nil, err
	}
	return contextNameFactory{t: t}, nil
}
func NewContextNameFactory ( fallback string ) ( ContextNameFactory , error ) { var format string if env , exists := os . LookupEnv ( " " ) ; exists { format = env } else if fallback == " " { format = GcloudDefaultFormat } else { format = fallback } t , err := template . New ( " " ) . Parse ( format ) if err != nil { return nil , err } return contextNameFactory { t : t } , nil }
NewContextNameFactory returns a new ContextNameFactory, preferring the format string in `$KUBECTL_GKE_CONTEXT_FORMAT`
over the provided string.
NewContextNameFactory returns a new ContextNameFactory preferring the format string in ` $KUBECTL_GKE_CONTEXT_FORMAT ` over the provided string .