Using rclone touch recursively

@ncw Someone else posted on my pull request, I made most of the fixes they mentioned but I was unsure about the ListFn.

This was from your post further up, where should that be declared, they mentioned the following.

Maybe this needs to be operations.ListFn..., and with an "" entry in import up in the beginning of the file.

Yes that will fix it up if you want to have a go.

However I'd really like the whole TouchRecursive function , plus tests in fs/operations/operations.go rather than in cmd/touch/touch.go and I'd like it to take a time.Time as the parameter.

@ncw I'm confused as why it's fine for the Touch function to be in touch.go, but not for the TouchRecursive function? Also the TouchRecursive function does take a time.Time parameter.

Are you asking for new files such as ListFn.go to be in operations, and that file would contain this maybe?

func ListFn(ctx, f, func(o fs.Object) {
        err := o.SetModTime(ctx, timeAtr)
        if err != nil {
                err = fs.CountError(err)
                fs.Errorf(o, "touch: couldn't set mod time %v", err)

It is to do with testing. Any code in operations will get tested against all the backends in the integration tests. Whereas the code in cmd doesn't.

operations has a ListFn already and that function just does SetModTime on a single file which is already tested so doesn't need to go in operations.

Its not a big deal - you can leave TouchRecursive in cmd/touch as its building blocks SetModTime and ListFn are well tested against all backends.

@ncw I have fixed up a few things, no new pull request yet, I can't get Go environment to work on Debian. I made a separate post about this.

@ncw What does this mean?

imports import cycle not allowed

Perhaps you can update your pull request, even if your code does not build. Easier to help when we see the full source code..

@albertony How do I update a pull request? not sure how to do that, I was just going to submit a new pull request.

I see your pull request is from your master. Normally one creates the pull request from a branch, and then one can just commit and push additional changes and they will be included in the pull request automatically. Not sure with master, but maybe its the same...

Oh I deleted my old repo, and created a new repo and have a new branch on that one.

OK. I guess you can just create a new pull request as you planned, then.

@ncw @albertony This is the new pull request.

Great my new pull request has failed again, with errors that don't tell you why it failed!

If you click details on the failing checks, you can go into the build log and you will see the errors.

E.g line 313 on windows 386:

fs\operations\touch.go:5:2: imported and not used: "fmt"

Where did you find that?

All I can see is...

Error: make: *** [Makefile:49: rclone] Error 2
Error: Process completed with exit code 2.

I don't fully understand what is the difference here... But first of all you must be logged in to GitHub. Then, either click Details on the failing checks, or go into the Actions tab and click your failing workflow. Then you must click on the individual jobs in the left pane, e.g. "windows_amd64", and you should see the full build log to the right. ...or maybe this is a permission thing, so you have not access to this?

This is what I see:

I haven't read all the details, but may be this tip was more applicable in this thread :grinning:

I saw that :slight_smile: Good advice in your last post there! :+1:

You may find guidance in my draft update of the rclone contributing guide.

Please let me know if you find anything wrong or missing, while preparing your recursive touch.

The above draft is my first iteration on this:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.