cleanup backend initialization

This commit is contained in:
Michael Eischer 2025-02-07 19:08:51 +01:00
parent c752867f0a
commit d378a171c8
1 changed files with 5 additions and 4 deletions

View File

@ -148,11 +148,12 @@ func (opts *GlobalOptions) AddFlags(f *pflag.FlagSet) {
} }
var globalOptions = GlobalOptions{ var globalOptions = GlobalOptions{
stdout: os.Stdout, stdout: os.Stdout,
stderr: os.Stderr, stderr: os.Stderr,
backends: collectBackends(),
} }
func init() { func collectBackends() *location.Registry {
backends := location.NewRegistry() backends := location.NewRegistry()
backends.Register(azure.NewFactory()) backends.Register(azure.NewFactory())
backends.Register(b2.NewFactory()) backends.Register(b2.NewFactory())
@ -163,7 +164,7 @@ func init() {
backends.Register(s3.NewFactory()) backends.Register(s3.NewFactory())
backends.Register(sftp.NewFactory()) backends.Register(sftp.NewFactory())
backends.Register(swift.NewFactory()) backends.Register(swift.NewFactory())
globalOptions.backends = backends return backends
} }
func stdinIsTerminal() bool { func stdinIsTerminal() bool {