mirror of
https://github.com/restic/restic.git
synced 2025-08-12 04:27:40 +00:00
backend: let ParseConfig return a Config pointer
In order to change the backend initialization in `global.go` to be able to generically call cfg.ApplyEnvironment() for supported backends, the `interface{}` returned by `ParseConfig` must contain a pointer to the configuration. An alternative would be to use reflection to convert the type from `interface{}(Config)` to `interface{}(*Config)` (from value to pointer type). However, this would just complicate the type mess further.
This commit is contained in:
@@ -18,8 +18,9 @@ type memConfig struct {
|
||||
func newTestSuite() *test.Suite[*memConfig] {
|
||||
return &test.Suite[*memConfig]{
|
||||
// NewConfig returns a config for a new temporary backend that will be used in tests.
|
||||
NewConfig: func() (*memConfig, error) {
|
||||
return &memConfig{}, nil
|
||||
NewConfig: func() (**memConfig, error) {
|
||||
cfg := &memConfig{}
|
||||
return &cfg, nil
|
||||
},
|
||||
|
||||
// CreateFn is a function that creates a temporary repository for the tests.
|
||||
|
Reference in New Issue
Block a user