mirror of
https://github.com/restic/restic.git
synced 2025-12-12 06:32:06 +00:00
bump required go version to 1.21
This commit is contained in:
@@ -94,7 +94,7 @@ func run(command string, args ...string) (*StdioConn, *sync.WaitGroup, chan stru
|
||||
err = errW
|
||||
}
|
||||
if err != nil {
|
||||
if util.IsErrDot(err) {
|
||||
if errors.Is(err, exec.ErrDot) {
|
||||
return nil, nil, nil, nil, errors.Errorf("cannot implicitly run relative executable %v found in current directory, use -o rclone.program=./<program> to override", cmd.Path)
|
||||
}
|
||||
return nil, nil, nil, nil, err
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
//go:build go1.20
|
||||
// +build go1.20
|
||||
|
||||
package rest_test
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//go:build !windows && go1.20
|
||||
// +build !windows,go1.20
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package rest_test
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ func startClient(cfg Config) (*SFTP, error) {
|
||||
|
||||
bg, err := util.StartForeground(cmd)
|
||||
if err != nil {
|
||||
if util.IsErrDot(err) {
|
||||
if errors.Is(err, exec.ErrDot) {
|
||||
return nil, errors.Errorf("cannot implicitly run relative executable %v found in current directory, use -o sftp.command=./<command> to override", cmd.Path)
|
||||
}
|
||||
return nil, err
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
//go:build go1.19
|
||||
// +build go1.19
|
||||
|
||||
// This file provides a function to check whether an error from cmd.Start() is
|
||||
// exec.ErrDot which was introduced in Go 1.19.
|
||||
// This function is needed so that we can perform this check only for Go 1.19 and
|
||||
// up, whereas for older versions we use a dummy/stub in the file errdot_old.go.
|
||||
// Once the minimum Go version restic supports is 1.19, remove this file and
|
||||
// replace any calls to it with the corresponding code as per below.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func IsErrDot(err error) bool {
|
||||
return errors.Is(err, exec.ErrDot)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//go:build !go1.19
|
||||
// +build !go1.19
|
||||
|
||||
// This file provides a stub for IsErrDot() for Go versions below 1.19.
|
||||
// See the corresponding file errdot_119.go for more information.
|
||||
// Once the minimum Go version restic supports is 1.19, remove this file
|
||||
// and perform the actions listed in errdot_119.go.
|
||||
|
||||
package util
|
||||
|
||||
func IsErrDot(err error) bool {
|
||||
return false
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import (
|
||||
// to the previous process group.
|
||||
//
|
||||
// The command's environment has all RESTIC_* variables removed.
|
||||
//
|
||||
// Return exec.ErrDot if it would implicitly run an executable from the current
|
||||
// directory.
|
||||
func StartForeground(cmd *exec.Cmd) (bg func() error, err error) {
|
||||
env := os.Environ() // Returns a copy that we can modify.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user