mirror of
https://github.com/restic/restic.git
synced 2026-08-15 01:53:17 +00:00
Apply go fix -any ./...
This commit is contained in:
@@ -16,7 +16,7 @@ type Options map[string]string
|
||||
var opts []Help
|
||||
|
||||
// Register allows registering options so that they can be listed with List.
|
||||
func Register(ns string, cfg interface{}) {
|
||||
func Register(ns string, cfg any) {
|
||||
opts = appendAllOptions(opts, ns, cfg)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func List() (list []Help) {
|
||||
}
|
||||
|
||||
// appendAllOptions appends all options in cfg to opts, sorted by namespace.
|
||||
func appendAllOptions(opts []Help, ns string, cfg interface{}) []Help {
|
||||
func appendAllOptions(opts []Help, ns string, cfg any) []Help {
|
||||
for _, opt := range listOptions(cfg) {
|
||||
opt.Namespace = ns
|
||||
opts = append(opts, opt)
|
||||
@@ -39,7 +39,7 @@ func appendAllOptions(opts []Help, ns string, cfg interface{}) []Help {
|
||||
}
|
||||
|
||||
// listOptions returns a list of options of cfg.
|
||||
func listOptions(cfg interface{}) (opts []Help) {
|
||||
func listOptions(cfg any) (opts []Help) {
|
||||
// resolve indirection if cfg is a pointer
|
||||
v := reflect.Indirect(reflect.ValueOf(cfg))
|
||||
|
||||
@@ -145,7 +145,7 @@ func (o Options) Extract(ns string) Options {
|
||||
|
||||
// Apply sets the options on dst via reflection, using the struct tag `option`.
|
||||
// The namespace argument (ns) is only used for error messages.
|
||||
func (o Options) Apply(ns string, dst interface{}) error {
|
||||
func (o Options) Apply(ns string, dst any) error {
|
||||
v := reflect.ValueOf(dst).Elem()
|
||||
|
||||
fields := make(map[string]reflect.StructField)
|
||||
|
||||
Reference in New Issue
Block a user