Skip to content

watch not parsing sources #2862

@TTSKarlsson

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: watcherChanges related to the Taskfile watcher.state: duplicateDuplicates another issue.state: needs triageWaiting to be triaged by a maintainer.

    Type

    No fields configured for bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions