@@ -396,7 +396,7 @@ func (c *InitCommand) getProvidersFromConfig(ctx context.Context, config *config
396396 log .Printf ("[DEBUG] will search for provider plugins in %s" , pluginDirs )
397397 }
398398
399- evts := c .prepareInstallerEvents (ctx , reqs , diags , inst , view , views .InitializingProviderPluginFromConfigMessage , views .ReusingPreviousVersionInfo )
399+ evts := c .prepareInstallerEvents (ctx , reqs , & diags , inst , view , views .InitializingProviderPluginFromConfigMessage , views .ReusingPreviousVersionInfo )
400400 ctx = evts .OnContext (ctx )
401401
402402 mode := providercache .InstallNewProvidersOnly
@@ -513,7 +513,7 @@ func (c *InitCommand) getProvidersFromState(ctx context.Context, state *states.S
513513 // things relatively concise. Later it'd be nice to have a progress UI
514514 // where statuses update in-place, but we can't do that as long as we
515515 // are shimming our vt100 output to the legacy console API on Windows.
516- evts := c .prepareInstallerEvents (ctx , reqs , diags , inst , view , views .InitializingProviderPluginFromStateMessage , views .ReusingVersionIdentifiedFromConfig )
516+ evts := c .prepareInstallerEvents (ctx , reqs , & diags , inst , view , views .InitializingProviderPluginFromStateMessage , views .ReusingVersionIdentifiedFromConfig )
517517 ctx = evts .OnContext (ctx )
518518
519519 mode := providercache .InstallNewProvidersOnly
@@ -617,7 +617,7 @@ func (c *InitCommand) saveDependencyLockFile(previousLocks, configLocks, stateLo
617617// prepareInstallerEvents returns an instance of *providercache.InstallerEvents. This struct defines callback functions that will be executed
618618// when a specific type of event occurs during provider installation.
619619// The calling code needs to provide a tfdiags.Diagnostics collection, so that provider installation code returns diags to the calling code using closures
620- func (c * InitCommand ) prepareInstallerEvents (ctx context.Context , reqs providerreqs.Requirements , diags tfdiags.Diagnostics , inst * providercache.Installer , view views.Init , initMsg views.InitMessageCode , reuseMsg views.InitMessageCode ) * providercache.InstallerEvents {
620+ func (c * InitCommand ) prepareInstallerEvents (ctx context.Context , reqs providerreqs.Requirements , diags * tfdiags.Diagnostics , inst * providercache.Installer , view views.Init , initMsg views.InitMessageCode , reuseMsg views.InitMessageCode ) * providercache.InstallerEvents {
621621
622622 // Because we're currently just streaming a series of events sequentially
623623 // into the terminal, we're showing only a subset of the events to keep
@@ -635,7 +635,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
635635 view .LogInitMessage (views .BuiltInProviderAvailableMessage , provider .ForDisplay ())
636636 },
637637 BuiltInProviderFailure : func (provider addrs.Provider , err error ) {
638- diags = diags .Append (tfdiags .Sourceless (
638+ * diags = diags .Append (tfdiags .Sourceless (
639639 tfdiags .Error ,
640640 "Invalid dependency on built-in provider" ,
641641 fmt .Sprintf ("Cannot use %s: %s." , provider .ForDisplay (), err ),
@@ -666,7 +666,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
666666 for i , source := range sources {
667667 displaySources [i ] = fmt .Sprintf (" - %s" , source )
668668 }
669- diags = diags .Append (tfdiags .Sourceless (
669+ * diags = diags .Append (tfdiags .Sourceless (
670670 tfdiags .Error ,
671671 "Failed to query available provider packages" ,
672672 fmt .Sprintf ("Could not retrieve the list of available versions for provider %s: %s\n \n %s" ,
@@ -685,7 +685,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
685685 )
686686 }
687687
688- diags = diags .Append (tfdiags .Sourceless (
688+ * diags = diags .Append (tfdiags .Sourceless (
689689 tfdiags .Error ,
690690 "Failed to query available provider packages" ,
691691 fmt .Sprintf ("Could not retrieve the list of available versions for provider %s: %s%s" ,
@@ -703,7 +703,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
703703 // provider registry, to allow for the (admittedly currently
704704 // rather unlikely) possibility that github.com starts being
705705 // a real Terraform provider registry in the future.
706- diags = diags .Append (tfdiags .Sourceless (
706+ * diags = diags .Append (tfdiags .Sourceless (
707707 tfdiags .Error ,
708708 "Invalid provider registry host" ,
709709 fmt .Sprintf ("The given source address %q specifies a GitHub repository rather than a Terraform provider. Refer to the documentation of the provider to find the correct source address to use." ,
@@ -712,7 +712,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
712712 ))
713713
714714 case errorTy .HasOtherVersion :
715- diags = diags .Append (tfdiags .Sourceless (
715+ * diags = diags .Append (tfdiags .Sourceless (
716716 tfdiags .Error ,
717717 "Invalid provider registry host" ,
718718 fmt .Sprintf ("The host %q given in provider source address %q does not offer a Terraform provider registry that is compatible with this Terraform version, but it may be compatible with a different Terraform version." ,
@@ -721,7 +721,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
721721 ))
722722
723723 default :
724- diags = diags .Append (tfdiags .Sourceless (
724+ * diags = diags .Append (tfdiags .Sourceless (
725725 tfdiags .Error ,
726726 "Invalid provider registry host" ,
727727 fmt .Sprintf ("The host %q given in provider source address %q does not offer a Terraform provider registry." ,
@@ -737,7 +737,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
737737
738738 default :
739739 suggestion := fmt .Sprintf ("\n \n To see which modules are currently depending on %s and what versions are specified, run the following command:\n terraform providers" , provider .ForDisplay ())
740- diags = diags .Append (tfdiags .Sourceless (
740+ * diags = diags .Append (tfdiags .Sourceless (
741741 tfdiags .Error ,
742742 "Failed to query available provider packages" ,
743743 fmt .Sprintf ("Could not retrieve the list of available versions for provider %s: %s%s" ,
@@ -753,7 +753,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
753753 displayWarnings [i ] = fmt .Sprintf ("- %s" , warning )
754754 }
755755
756- diags = diags .Append (tfdiags .Sourceless (
756+ * diags = diags .Append (tfdiags .Sourceless (
757757 tfdiags .Warning ,
758758 "Additional provider information from registry" ,
759759 fmt .Sprintf ("The remote registry returned warnings for %s:\n %s" ,
@@ -763,7 +763,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
763763 ))
764764 },
765765 LinkFromCacheFailure : func (provider addrs.Provider , version getproviders.Version , err error ) {
766- diags = diags .Append (tfdiags .Sourceless (
766+ * diags = diags .Append (tfdiags .Sourceless (
767767 tfdiags .Error ,
768768 "Failed to install provider from shared cache" ,
769769 fmt .Sprintf ("Error while importing %s v%s from the shared cache directory: %s." , provider .ForDisplay (), version , err ),
@@ -776,13 +776,13 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
776776 closestAvailable := err .Suggestion
777777 switch {
778778 case closestAvailable == getproviders .UnspecifiedVersion :
779- diags = diags .Append (tfdiags .Sourceless (
779+ * diags = diags .Append (tfdiags .Sourceless (
780780 tfdiags .Error ,
781781 summaryIncompatible ,
782782 fmt .Sprintf (errProviderVersionIncompatible , provider .String ()),
783783 ))
784784 case version .GreaterThan (closestAvailable ):
785- diags = diags .Append (tfdiags .Sourceless (
785+ * diags = diags .Append (tfdiags .Sourceless (
786786 tfdiags .Error ,
787787 summaryIncompatible ,
788788 fmt .Sprintf (providerProtocolTooNew , provider .ForDisplay (),
@@ -791,7 +791,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
791791 ),
792792 ))
793793 default : // version is less than closestAvailable
794- diags = diags .Append (tfdiags .Sourceless (
794+ * diags = diags .Append (tfdiags .Sourceless (
795795 tfdiags .Error ,
796796 summaryIncompatible ,
797797 fmt .Sprintf (providerProtocolTooOld , provider .ForDisplay (),
@@ -806,7 +806,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
806806 // If we're installing from a mirror then it may just be
807807 // the mirror lacking the package, rather than it being
808808 // unavailable from upstream.
809- diags = diags .Append (tfdiags .Sourceless (
809+ * diags = diags .Append (tfdiags .Sourceless (
810810 tfdiags .Error ,
811811 summaryIncompatible ,
812812 fmt .Sprintf (
@@ -816,7 +816,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
816816 ),
817817 ))
818818 default :
819- diags = diags .Append (tfdiags .Sourceless (
819+ * diags = diags .Append (tfdiags .Sourceless (
820820 tfdiags .Error ,
821821 summaryIncompatible ,
822822 fmt .Sprintf (
@@ -841,7 +841,7 @@ func (c *InitCommand) prepareInstallerEvents(ctx context.Context, reqs providerr
841841 // as a cancellation after the installer returns and do the
842842 // normal cancellation handling.
843843
844- diags = diags .Append (tfdiags .Sourceless (
844+ * diags = diags .Append (tfdiags .Sourceless (
845845 tfdiags .Error ,
846846 "Failed to install provider" ,
847847 fmt .Sprintf ("Error while installing %s v%s: %s" , provider .ForDisplay (), version , err ),
0 commit comments