Error strings should not be capitalized

Reported by staticcheck 2022.1.2 (v0.3.2)

See: staticcheck.io
This commit is contained in:
albertony
2022-06-23 23:26:02 +02:00
parent 027746ef6e
commit fdd2f8e6d2
65 changed files with 159 additions and 159 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ func newFsFileAddFilter(remote string) (fs.Fs, string) {
f, fileName := NewFsFile(remote)
if fileName != "" {
if !fi.InActive() {
err := fmt.Errorf("Can't limit to single files when using filters: %v", remote)
err := fmt.Errorf("can't limit to single files when using filters: %v", remote)
err = fs.CountError(err)
log.Fatalf(err.Error())
}
+1 -1
View File
@@ -402,7 +402,7 @@ To reconnect use "rclone config reconnect".
}
err := doDisconnect(context.Background())
if err != nil {
return fmt.Errorf("Disconnect call failed: %w", err)
return fmt.Errorf("disconnect call failed: %w", err)
}
return nil
},
+1 -1
View File
@@ -48,7 +48,7 @@ See the documentation on the [crypt](/crypt/) overlay for more info.
return err
}
if fsInfo.Name != "crypt" {
return errors.New("The remote needs to be of type \"crypt\"")
return errors.New("the remote needs to be of type \"crypt\"")
}
cipher, err := crypt.NewCipher(config)
if err != nil {
+1 -1
View File
@@ -199,7 +199,7 @@ func Lsf(ctx context.Context, fsrc fs.Fs, out io.Writer) error {
case 'T':
list.AddTier()
default:
return fmt.Errorf("Unknown format character %q", char)
return fmt.Errorf("unknown format character %q", char)
}
}
+1 -1
View File
@@ -199,7 +199,7 @@ func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefs
defer log.Trace(d, "oldName=%q, newName=%q, newDir=%+v", req.OldName, req.NewName, newDir)("err=%v", &err)
destDir, ok := newDir.(*Dir)
if !ok {
return fmt.Errorf("Unknown Dir type %T", newDir)
return fmt.Errorf("unknown Dir type %T", newDir)
}
err = d.Dir.Rename(req.OldName, req.NewName, destDir.Dir)
+1 -1
View File
@@ -22,7 +22,7 @@ const (
// On Linux we use the OS-specific /proc/mount API so the check won't access the path.
// Directories marked as "mounted" by autofs are considered not mounted.
func CheckMountEmpty(mountpoint string) error {
const msg = "Directory already mounted, use --allow-non-empty to mount anyway: %s"
const msg = "directory already mounted, use --allow-non-empty to mount anyway: %s"
mountpointAbs, err := filepath.Abs(mountpoint)
if err != nil {
+2 -2
View File
@@ -17,7 +17,7 @@ import (
func CheckMountEmpty(mountpoint string) error {
fp, err := os.Open(mountpoint)
if err != nil {
return fmt.Errorf("Can not open: %s: %w", mountpoint, err)
return fmt.Errorf("cannot open: %s: %w", mountpoint, err)
}
defer fs.CheckClose(fp, &err)
@@ -26,7 +26,7 @@ func CheckMountEmpty(mountpoint string) error {
return nil
}
const msg = "Directory is not empty, use --allow-non-empty to mount anyway: %s"
const msg = "directory is not empty, use --allow-non-empty to mount anyway: %s"
if err == nil {
return fmt.Errorf(msg, mountpoint)
}
+1 -1
View File
@@ -211,7 +211,7 @@ func doCall(ctx context.Context, path string, in rc.Params) (out rc.Params, err
bodyString = err.Error()
}
bodyString = strings.TrimSpace(bodyString)
return nil, fmt.Errorf("Failed to read rc response: %s: %s", resp.Status, bodyString)
return nil, fmt.Errorf("failed to read rc response: %s: %s", resp.Status, bodyString)
}
// Parse output
+10 -10
View File
@@ -135,11 +135,11 @@ var passivePortsRe = regexp.MustCompile(`^\s*\d+\s*-\s*\d+\s*$`)
func newServer(ctx context.Context, f fs.Fs, opt *Options) (*server, error) {
host, port, err := net.SplitHostPort(opt.ListenAddr)
if err != nil {
return nil, errors.New("Failed to parse host:port")
return nil, errors.New("failed to parse host:port")
}
portNum, err := strconv.Atoi(port)
if err != nil {
return nil, errors.New("Failed to parse host:port")
return nil, errors.New("failed to parse host:port")
}
s := &server{
@@ -284,7 +284,7 @@ func (d *Driver) ChangeDir(path string) (err error) {
return err
}
if !n.IsDir() {
return errors.New("Not a directory")
return errors.New("not a directory")
}
return nil
}
@@ -296,12 +296,12 @@ func (d *Driver) ListDir(path string, callback func(ftp.FileInfo) error) (err er
defer log.Trace(path, "")("err = %v", &err)
node, err := d.vfs.Stat(path)
if err == vfs.ENOENT {
return errors.New("Directory not found")
return errors.New("directory not found")
} else if err != nil {
return err
}
if !node.IsDir() {
return errors.New("Not a directory")
return errors.New("not a directory")
}
dir := node.(*vfs.Dir)
@@ -335,7 +335,7 @@ func (d *Driver) DeleteDir(path string) (err error) {
return err
}
if !node.IsDir() {
return errors.New("Not a directory")
return errors.New("not a directory")
}
err = node.Remove()
if err != nil {
@@ -354,7 +354,7 @@ func (d *Driver) DeleteFile(path string) (err error) {
return err
}
if !node.IsFile() {
return errors.New("Not a file")
return errors.New("not a file")
}
err = node.Remove()
if err != nil {
@@ -392,12 +392,12 @@ func (d *Driver) GetFile(path string, offset int64) (size int64, fr io.ReadClose
node, err := d.vfs.Stat(path)
if err == vfs.ENOENT {
fs.Infof(path, "File not found")
return 0, nil, errors.New("File not found")
return 0, nil, errors.New("file not found")
} else if err != nil {
return 0, nil, err
}
if !node.IsFile() {
return 0, nil, errors.New("Not a file")
return 0, nil, errors.New("not a file")
}
handle, err := node.Open(os.O_RDONLY)
@@ -426,7 +426,7 @@ func (d *Driver) PutFile(path string, data io.Reader, appendData bool) (n int64,
if err == nil {
isExist = true
if node.IsDir() {
return 0, errors.New("A dir has the same name")
return 0, errors.New("a dir has the same name")
}
} else {
if os.IsNotExist(err) {
+1 -1
View File
@@ -139,7 +139,7 @@ with a path of ` + "`/<username>/`" + `.
s := NewServer(f, &httpflags.Opt)
if stdio {
if terminal.IsTerminal(int(os.Stdout.Fd())) {
return errors.New("Refusing to run HTTP2 server directly on a terminal, please let restic start rclone")
return errors.New("refusing to run HTTP2 server directly on a terminal, please let restic start rclone")
}
conn := &StdioConn{
+1 -1
View File
@@ -74,7 +74,7 @@ func (c *conn) execCommand(ctx context.Context, out io.Writer, command string) (
}
usage, err := about(ctx)
if err != nil {
return fmt.Errorf("About failed: %w", err)
return fmt.Errorf("about failed: %w", err)
}
total, used, free := int64(-1), int64(-1), int64(-1)
if usage.Total != nil {
+1 -1
View File
@@ -47,7 +47,7 @@ Or just provide remote directory and all files in directory will be tiered
cmd.Run(false, false, command, func() error {
isSupported := fsrc.Features().SetTier
if !isSupported {
return fmt.Errorf("Remote %s does not support settier", fsrc.Name())
return fmt.Errorf("remote %s does not support settier", fsrc.Name())
}
return operations.SetTier(context.Background(), fsrc, tier)
+3 -3
View File
@@ -102,7 +102,7 @@ For a more interactive navigation of the remote see the
var err error
outFile, err = os.Create(outFileName)
if err != nil {
return fmt.Errorf("failed to create output file: %v", err)
return fmt.Errorf("failed to create output file: %w", err)
}
}
opts.VerSort = opts.VerSort || sort == "version"
@@ -209,7 +209,7 @@ func (dirs Fs) Stat(filePath string) (fi os.FileInfo, err error) {
}
_, entry := dirtree.DirTree(dirs).Find(filePath)
if entry == nil {
return nil, fmt.Errorf("Couldn't find %q in directory cache", filePath)
return nil, fmt.Errorf("couldn't find %q in directory cache", filePath)
}
return &FileInfo{entry}, nil
}
@@ -221,7 +221,7 @@ func (dirs Fs) ReadDir(dir string) (names []string, err error) {
dir = strings.TrimLeft(dir, "/")
entries, ok := dirs[dir]
if !ok {
return nil, fmt.Errorf("Couldn't find directory %q", dir)
return nil, fmt.Errorf("couldn't find directory %q", dir)
}
for _, entry := range entries {
names = append(names, path.Base(entry.Remote()))