mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
build: remove x := x made unnecessary by the new semantics of loops in go1.22
Signed-off-by: russcoss <russcoss@outlook.com>
This commit is contained in:
@@ -2152,7 +2152,6 @@ func (o *Object) getMetadata() (metadata map[string]*string) {
|
|||||||
}
|
}
|
||||||
metadata = make(map[string]*string, len(o.meta))
|
metadata = make(map[string]*string, len(o.meta))
|
||||||
for k, v := range o.meta {
|
for k, v := range o.meta {
|
||||||
v := v
|
|
||||||
metadata[k] = &v
|
metadata[k] = &v
|
||||||
}
|
}
|
||||||
return metadata
|
return metadata
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (outFs fs
|
|||||||
g, gCtx := errgroup.WithContext(ctx)
|
g, gCtx := errgroup.WithContext(ctx)
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
for _, upstream := range opt.Upstreams {
|
for _, upstream := range opt.Upstreams {
|
||||||
upstream := upstream
|
|
||||||
g.Go(func() (err error) {
|
g.Go(func() (err error) {
|
||||||
equal := strings.IndexRune(upstream, '=')
|
equal := strings.IndexRune(upstream, '=')
|
||||||
if equal < 0 {
|
if equal < 0 {
|
||||||
@@ -370,7 +369,6 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (outFs fs
|
|||||||
func (f *Fs) multithread(ctx context.Context, fn func(context.Context, *upstream) error) error {
|
func (f *Fs) multithread(ctx context.Context, fn func(context.Context, *upstream) error) error {
|
||||||
g, gCtx := errgroup.WithContext(ctx)
|
g, gCtx := errgroup.WithContext(ctx)
|
||||||
for _, u := range f.upstreams {
|
for _, u := range f.upstreams {
|
||||||
u := u
|
|
||||||
g.Go(func() (err error) {
|
g.Go(func() (err error) {
|
||||||
return fn(gCtx, u)
|
return fn(gCtx, u)
|
||||||
})
|
})
|
||||||
@@ -637,7 +635,6 @@ func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryT
|
|||||||
var uChans []chan time.Duration
|
var uChans []chan time.Duration
|
||||||
|
|
||||||
for _, u := range f.upstreams {
|
for _, u := range f.upstreams {
|
||||||
u := u
|
|
||||||
if do := u.f.Features().ChangeNotify; do != nil {
|
if do := u.f.Features().ChangeNotify; do != nil {
|
||||||
ch := make(chan time.Duration)
|
ch := make(chan time.Duration)
|
||||||
uChans = append(uChans, ch)
|
uChans = append(uChans, ch)
|
||||||
|
|||||||
@@ -386,7 +386,6 @@ func (o *baseObject) parseMetadata(ctx context.Context, info *drive.File) (err e
|
|||||||
g.SetLimit(o.fs.ci.Checkers)
|
g.SetLimit(o.fs.ci.Checkers)
|
||||||
var mu sync.Mutex // protect the info.Permissions from concurrent writes
|
var mu sync.Mutex // protect the info.Permissions from concurrent writes
|
||||||
for _, permissionID := range info.PermissionIds {
|
for _, permissionID := range info.PermissionIds {
|
||||||
permissionID := permissionID
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
// must fetch the team drive ones individually to check the inherited flag
|
// must fetch the team drive ones individually to check the inherited flag
|
||||||
perm, inherited, err := o.fs.getPermission(gCtx, actualID(info.Id), permissionID, !o.fs.isTeamDrive)
|
perm, inherited, err := o.fs.getPermission(gCtx, actualID(info.Id), permissionID, !o.fs.isTeamDrive)
|
||||||
@@ -520,7 +519,6 @@ func (f *Fs) updateMetadata(ctx context.Context, updateInfo *drive.File, meta fs
|
|||||||
}
|
}
|
||||||
// merge metadata into request and user metadata
|
// merge metadata into request and user metadata
|
||||||
for k, v := range meta {
|
for k, v := range meta {
|
||||||
k, v := k, v
|
|
||||||
// parse a boolean from v and write into out
|
// parse a boolean from v and write into out
|
||||||
parseBool := func(out *bool) error {
|
parseBool := func(out *bool) error {
|
||||||
b, err := strconv.ParseBool(v)
|
b, err := strconv.ParseBool(v)
|
||||||
|
|||||||
@@ -243,7 +243,6 @@ func (m *Metadata) Get(ctx context.Context) (metadata fs.Metadata, err error) {
|
|||||||
func (m *Metadata) Set(ctx context.Context, metadata fs.Metadata) (numSet int, err error) {
|
func (m *Metadata) Set(ctx context.Context, metadata fs.Metadata) (numSet int, err error) {
|
||||||
numSet = 0
|
numSet = 0
|
||||||
for k, v := range metadata {
|
for k, v := range metadata {
|
||||||
k, v := k, v
|
|
||||||
switch k {
|
switch k {
|
||||||
case "mtime":
|
case "mtime":
|
||||||
t, err := time.Parse(timeFormatIn, v)
|
t, err := time.Parse(timeFormatIn, v)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ func (p *EpFF) epff(ctx context.Context, upstreams []*upstream.Fs, filePath stri
|
|||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
for _, u := range upstreams {
|
for _, u := range upstreams {
|
||||||
u := u // Closure
|
|
||||||
go func() {
|
go func() {
|
||||||
rfs := u.RootFs
|
rfs := u.RootFs
|
||||||
remote := path.Join(u.RootPath, filePath)
|
remote := path.Join(u.RootPath, filePath)
|
||||||
|
|||||||
@@ -229,7 +229,6 @@ func TestEndToEnd(t *testing.T) {
|
|||||||
skipE2eTestIfNecessary(t)
|
skipE2eTestIfNecessary(t)
|
||||||
|
|
||||||
for _, mode := range allLayoutModes() {
|
for _, mode := range allLayoutModes() {
|
||||||
mode := mode
|
|
||||||
t.Run(string(mode), func(t *testing.T) {
|
t.Run(string(mode), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -258,7 +257,6 @@ func TestEndToEndMigration(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, mode := range allLayoutModes() {
|
for _, mode := range allLayoutModes() {
|
||||||
mode := mode
|
|
||||||
t.Run(string(mode), func(t *testing.T) {
|
t.Run(string(mode), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -318,7 +316,6 @@ func TestEndToEndRepoLayoutCompat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, mode := range allLayoutModes() {
|
for _, mode := range allLayoutModes() {
|
||||||
mode := mode
|
|
||||||
t.Run(string(mode), func(t *testing.T) {
|
t.Run(string(mode), func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ func testCacheCRUD(t *testing.T, h *Handler, c Cache, fileName string) {
|
|||||||
func testCacheThrashDifferent(t *testing.T, h *Handler, c Cache) {
|
func testCacheThrashDifferent(t *testing.T, h *Handler, c Cache) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for i := range 100 {
|
for i := range 100 {
|
||||||
i := i
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
@@ -125,7 +124,6 @@ func TestCache(t *testing.T) {
|
|||||||
}()
|
}()
|
||||||
billyFS := &FS{nil} // place holder billyFS
|
billyFS := &FS{nil} // place holder billyFS
|
||||||
for _, cacheType := range []handleCache{cacheMemory, cacheDisk, cacheSymlink} {
|
for _, cacheType := range []handleCache{cacheMemory, cacheDisk, cacheSymlink} {
|
||||||
cacheType := cacheType
|
|
||||||
t.Run(cacheType.String(), func(t *testing.T) {
|
t.Run(cacheType.String(), func(t *testing.T) {
|
||||||
h := &Handler{
|
h := &Handler{
|
||||||
vfs: vfs.New(object.MemoryFs, nil),
|
vfs: vfs.New(object.MemoryFs, nil),
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ func rcProviders(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for _, name := range []string{"create", "update", "password"} {
|
for _, name := range []string{"create", "update", "password"} {
|
||||||
name := name
|
|
||||||
extraHelp := ""
|
extraHelp := ""
|
||||||
if name == "create" {
|
if name == "create" {
|
||||||
extraHelp = "- type - type of the new remote\n"
|
extraHelp = "- type - type of the new remote\n"
|
||||||
|
|||||||
@@ -222,7 +222,6 @@ func (lh *listHelper) send(max int) (err error) {
|
|||||||
g, gCtx := errgroup.WithContext(lh.ls.ctx)
|
g, gCtx := errgroup.WithContext(lh.ls.ctx)
|
||||||
g.SetLimit(lh.ls.ci.Checkers)
|
g.SetLimit(lh.ls.ci.Checkers)
|
||||||
for i, key := range lh.keys {
|
for i, key := range lh.keys {
|
||||||
i, key := i, key // can remove when go1.22 is minimum version
|
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
lh.entries[i], lh.errs[i] = lh.ls.keyToEntry(gCtx, key)
|
lh.entries[i], lh.errs[i] = lh.ls.keyToEntry(gCtx, key)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ func rcAbout(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for _, copy := range []bool{false, true} {
|
for _, copy := range []bool{false, true} {
|
||||||
copy := copy
|
|
||||||
name := "Move"
|
name := "Move"
|
||||||
if copy {
|
if copy {
|
||||||
name = "Copy"
|
name = "Copy"
|
||||||
@@ -217,7 +216,6 @@ func init() {
|
|||||||
{name: "settier", title: "Changes storage tier or class on all files in the path", noRemote: true},
|
{name: "settier", title: "Changes storage tier or class on all files in the path", noRemote: true},
|
||||||
{name: "settierfile", title: "Changes storage tier or class on the single file pointed to", noCommand: true},
|
{name: "settierfile", title: "Changes storage tier or class on the single file pointed to", noCommand: true},
|
||||||
} {
|
} {
|
||||||
op := op
|
|
||||||
var remote, command string
|
var remote, command string
|
||||||
if !op.noRemote {
|
if !op.noRemote {
|
||||||
remote = "- remote - a path within that remote e.g. \"dir\"\n"
|
remote = "- remote - a path within that remote e.g. \"dir\"\n"
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
for _, name := range []string{"sync", "copy", "move"} {
|
for _, name := range []string{"sync", "copy", "move"} {
|
||||||
name := name
|
|
||||||
moveHelp := ""
|
moveHelp := ""
|
||||||
if name == "move" {
|
if name == "move" {
|
||||||
moveHelp = "- deleteEmptySrcDirs - delete empty src directories if set\n"
|
moveHelp = "- deleteEmptySrcDirs - delete empty src directories if set\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user