mirror of
https://github.com/restic/restic.git
synced 2026-08-05 21:33:16 +00:00
Apply go fix -any ./...
This commit is contained in:
@@ -42,7 +42,7 @@ func ParseVSSConfig(o options.Options) (VSSConfig, error) {
|
||||
type ErrorHandler func(item string, err error)
|
||||
|
||||
// MessageHandler is used to report errors/messages via callbacks.
|
||||
type MessageHandler func(msg string, args ...interface{})
|
||||
type MessageHandler func(msg string, args ...any)
|
||||
|
||||
// volumeFilter is used to filter volumes by their mount point or GUID path.
|
||||
type volumeFilter func(volume string) bool
|
||||
|
||||
@@ -28,7 +28,7 @@ type commandReader struct {
|
||||
alreadyClosedReadErr error
|
||||
}
|
||||
|
||||
func NewCommandReader(ctx context.Context, args []string, errorOutput func(msg string, args ...interface{})) (io.ReadCloser, error) {
|
||||
func NewCommandReader(ctx context.Context, args []string, errorOutput func(msg string, args ...any)) (io.ReadCloser, error) {
|
||||
if len(args) == 0 {
|
||||
return nil, fmt.Errorf("no command was specified as argument")
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCommandReaderSuccess(t *testing.T) {
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"true"}, func(msg string, args ...interface{}) {})
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"true"}, func(msg string, args ...any) {})
|
||||
test.OK(t, err)
|
||||
|
||||
_, err = io.Copy(io.Discard, reader)
|
||||
@@ -23,7 +23,7 @@ func TestCommandReaderSuccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCommandReaderFail(t *testing.T) {
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"false"}, func(msg string, args ...interface{}) {})
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"false"}, func(msg string, args ...any) {})
|
||||
test.OK(t, err)
|
||||
|
||||
_, err = io.Copy(io.Discard, reader)
|
||||
@@ -31,17 +31,17 @@ func TestCommandReaderFail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCommandReaderInvalid(t *testing.T) {
|
||||
_, err := fs.NewCommandReader(context.TODO(), []string{"w54fy098hj7fy5twijouytfrj098y645wr"}, func(msg string, args ...interface{}) {})
|
||||
_, err := fs.NewCommandReader(context.TODO(), []string{"w54fy098hj7fy5twijouytfrj098y645wr"}, func(msg string, args ...any) {})
|
||||
test.Assert(t, err != nil, "missing error")
|
||||
}
|
||||
|
||||
func TestCommandReaderEmptyArgs(t *testing.T) {
|
||||
_, err := fs.NewCommandReader(context.TODO(), []string{}, func(msg string, args ...interface{}) {})
|
||||
_, err := fs.NewCommandReader(context.TODO(), []string{}, func(msg string, args ...any) {})
|
||||
test.Assert(t, err != nil, "missing error")
|
||||
}
|
||||
|
||||
func TestCommandReaderOutput(t *testing.T) {
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"echo", "hello world"}, func(msg string, args ...interface{}) {})
|
||||
reader, err := fs.NewCommandReader(context.TODO(), []string{"echo", "hello world"}, func(msg string, args ...any) {})
|
||||
test.OK(t, err)
|
||||
|
||||
var buf bytes.Buffer
|
||||
@@ -56,7 +56,7 @@ func TestCommandReaderOutput(t *testing.T) {
|
||||
func TestCommandReaderQuickClose(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), 10*time.Second)
|
||||
defer cancel()
|
||||
reader, err := fs.NewCommandReader(ctx, []string{"sleep", "3600"}, func(msg string, args ...interface{}) {})
|
||||
reader, err := fs.NewCommandReader(ctx, []string{"sleep", "3600"}, func(msg string, args ...any) {})
|
||||
test.OK(t, err)
|
||||
|
||||
// test that close returns before the context expires
|
||||
|
||||
@@ -122,7 +122,7 @@ func TestOverwriteXattrWithSelectFilter(t *testing.T) {
|
||||
file := filepath.Join(dir, "file2")
|
||||
rtest.OK(t, os.WriteFile(file, []byte("hello world"), 0o600))
|
||||
|
||||
noopWarnf := func(_ string, _ ...interface{}) {}
|
||||
noopWarnf := func(_ string, _ ...any) {}
|
||||
|
||||
// Set a filter as if the user passed in --include-xattr user.*
|
||||
xattrSelectFilter1 := func(xattrName string) bool {
|
||||
|
||||
Reference in New Issue
Block a user