Skip to content

watch not parsing sources #2862

Description

@TTSKarlsson

Description

I've been using go-task a lot over the years, but now with 3.50 I get this problem.

taskfile:

# https://taskfile.dev

version: '3'

tasks:
  dev:
    desc: Build and watch
    cmds:
      - cmd: echo hello
    sources:
      - app/main.go
    watch: true
    ignore_error: false
    method: none

The taskfile is in root of the project and there's a folder ./app and a file ./app/main.go

When I run it with go-task -v dev, it echos hello as I've asked it to, but when I save the main.go (whether or not I made any change) I get:

task: received watch event: WRITE         "E:\\<pathtoproject>\\app\\main.go"
task: skipped for file not in sources: app\main.go

I've tried changing sources to these variants and more that I can't remember right now:

  • 'app/main.go'
  • **/*.go
  • ./app/main.go
  • ./app/**/*.go
  • "./{{.APPFOLDER}}/main.go' (APPFOLDER set to app)
  • and so on...

What I expect:

I expect it to echo hello every time I save the main.go file, I don't know what version it stopped working or if my OS (win11) have changed something with watching files.

I'm using latest Powershell and Windows 11.

Version

3.50.0

Operating system

Windows 11

Experiments Enabled

No response

Example Taskfile

# https://taskfile.dev

version: '3'

tasks:
  dev:
    desc: Build and watch
    cmds:
      - cmd: echo hello
    sources:
      - app/main.go
    watch: true
    ignore_error: false
    method: none

Full output of task -v dev:

task: Started watching for tasks: dev
task: "dev" started
task: watching new dir: app
task: [dev] echo hello
hello
task: "dev" finished
task: task "dev" finished running
task: received watch event: WRITE         "E:\\syncthing\\devprojects\\golang\\kasta\\app\\main.go"
task: skipped for file not in sources: app\main.go

Activity

  1. trulede commented on May 30, 2026

    @trulede
    Contributor
  2. added theissue type on May 30, 2026
  3. TTSKarlsson commented on May 30, 2026

    @TTSKarlsson
    Author

    Maybe you're right, but none of the descriptions on those issues/PRs sufficiently overlaps this problem. The only similarity is that there's a problem with watch.

    I'll wait this out and use nodemon in the mean. 👍

  4. Edd532 commented on Jul 3, 2026

    @Edd532

    I've also have this exact issue - also on Windows. I believe here: https://github.com/go-task/task/blob/main/watch.go#L104

    That event.Name contains \ while the files contain /

  5. TTSKarlsson commented on Aug 18, 2026

    @TTSKarlsson
    Author

    I got back to trying this again in another project, but it's as Edd532 says, it doesn't seem to normalize paths when comparing.

    - '**\\*.go'
    and
    - '**/*.go'

    makes no difference.

  6. trulede commented on Aug 18, 2026

    @trulede
    Contributor

    Its possible that event.Name needs to be "normalised" to a linux like path, i.e. whatever form is in files. The files come via the glob mechanism of the mvdan.cc (linux bash emulation) and would have "/".

  7. TTSKarlsson commented on Sep 9, 2026

    @TTSKarlsson
    Author

    I would like to know if this is planned so that go-task would support Windows again. If it's not planned we'll just continue using something else and stop coming back to follow up. Could also be nice to be clear in the description of this tool.

  8. added
    os: windowsIssues that affect users on Windows.
    and removed
    state: needs triageWaiting to be triaged by a maintainer.
    on Sep 10, 2026
  9. pd93 commented on Sep 10, 2026

    @pd93
    Member

    @TTSKarlsson If able, please try out #3028. Hopefully fixes your issue.

  10. TTSKarlsson commented on Sep 16, 2026

    @TTSKarlsson
    Author

    A bit late to getting back. Just to confirm this did fix the problem. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: watcherChanges related to the Taskfile watcher.os: windowsIssues that affect users on Windows.

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions