Skip to content

watch mode issues #2829

@butuzov

Description

@butuzov

tl/dr

exclude not works in sources for a watch proccess.

Description

I did try to switch to 3.50.0 and immediately notice that bug I tried to solve in #2742

whats we have (v3.50.0) watching build process that genrates quite a lot of files, terminates watch process and restarts it (even if generated file in the sources[].exclude

> /opt/homebrew/bin/task tests:tdd -fvw
task: dynamic variable: "git describe --tags --match 'v*' --always --dirty" result: "82973a2-dirty"
task: dynamic variable: "git rev-parse HEAD" result: "82973a2724ba0dec6f59af84dfbecac8428fc269"
task: dynamic variable: "go env -json | jq -r '.GOOS'" result: "darwin"
task: dynamic variable: "go env -json | jq -r '.GOARCH'" result: "arm64"
task: Started watching for tasks: tests:tdd
task: "tests:tdd" started
task: watching new dir: api/v1
task: watching new dir: .
task: watching new dir: cmd/dbtest
task: watching new dir: cmd/migrate
task: watching new dir: cmd/migrate/migrations
task: watching new dir: cmd/migrate/schema
task: watching new dir: cmd/service
task: watching new dir: pkg/biz
task: watching new dir: pkg/conf
task: watching new dir: pkg/data
task: watching new dir: pkg/data/entity
task: watching new dir: pkg/data/outbox
task: watching new dir: pkg/data/outbox/events
task: watching new dir: pkg/data/outbox/handlers
task: watching new dir: pkg/data/outbox/handlers/openfga
task: watching new dir: pkg/data/outbox/handlers/ory_kratos
task: watching new dir: pkg/data/outbox/payload
task: watching new dir: pkg/data/outbox/targets
task: watching new dir: pkg/server
task: watching new dir: pkg/server/openapi
task: watching new dir: pkg/server/static
task: "tests" started
task: watching new dir: pkg/service
task: watching new dir: pkg/utils/bootstrap
task: watching new dir: pkg/utils/logger
task: watching new dir: pkg/utils/pager
task: watching new dir: protos/api/v1
task: watching new dir: protos/pkg/conf
task: watching new dir: resources
task: watching new dir: scripts
task: "tools:install:if_missing" started
task: [tools:install:if_missing] go tool | grep -q tparse || go get -tool github.com/mfridman/tparse@latest
task: [tools:install:if_missing] go mod tidy
task: "tools:install:if_missing" finished
task: [tests] go clean -testcache
task: [tests] go test -cover -race \
            -covermode=atomic\
            -coverprofile=coverage.out \
            -coverpkg $(go list ./... | grep -v -E "(api|cmd)" | tr "\n" ",")  \
            ./... -json |  go tool tparse -trimpath github.com/butuzov/api

task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
go tool tparse: signal: interrupt
task: dynamic variable: "git describe --tags --match 'v*' --always --dirty" result: "82973a2-dirty"
task: dynamic variable: "git rev-parse HEAD" result: "82973a2724ba0dec6f59af84dfbecac8428fc269"
task: dynamic variable: "go env -json | jq -r '.GOOS'" result: "darwin"
task: dynamic variable: "go env -json | jq -r '.GOARCH'" result: "arm64"
task: skipped for file not in sources: coverage.out

versus declined pull request

 > /Users/butuzov/go/bin/task tests:tdd -fvw
task: dynamic variable: "git describe --tags --match 'v*' --always --dirty" result: "82973a2-dirty"
task: dynamic variable: "git rev-parse HEAD" result: "82973a2724ba0dec6f59af84dfbecac8428fc269"
task: dynamic variable: "go env -json | jq -r '.GOOS'" result: "darwin"
task: dynamic variable: "go env -json | jq -r '.GOARCH'" result: "arm64"
task: Started watching for tasks: tests:tdd
task: "tests:tdd" started
task: watching new dir: api/v1
task: watching new dir: .
task: watching new dir: cmd/dbtest
task: watching new dir: cmd/migrate
task: watching new dir: cmd/migrate/migrations
task: watching new dir: cmd/migrate/schema
task: watching new dir: cmd/service
task: watching new dir: pkg/biz
task: watching new dir: pkg/conf
task: watching new dir: pkg/data
task: watching new dir: pkg/data/entity
task: "tests" started
task: watching new dir: pkg/data/outbox
task: watching new dir: pkg/data/outbox/events
task: watching new dir: pkg/data/outbox/handlers
task: watching new dir: pkg/data/outbox/handlers/openfga
task: watching new dir: pkg/data/outbox/handlers/ory_kratos
task: watching new dir: pkg/data/outbox/payload
task: watching new dir: pkg/data/outbox/targets
task: watching new dir: pkg/server
task: watching new dir: pkg/server/openapi
task: watching new dir: pkg/server/static
task: watching new dir: pkg/service
task: watching new dir: pkg/utils/bootstrap
task: watching new dir: pkg/utils/logger
task: watching new dir: pkg/utils/pager
task: watching new dir: protos/api/v1
task: watching new dir: protos/pkg/conf
task: watching new dir: resources
task: watching new dir: scripts
task: "tools:install:if_missing" started
task: [tools:install:if_missing] go tool | grep -q tparse || go get -tool github.com/mfridman/tparse@latest
task: [tools:install:if_missing] go mod tidy
task: "tools:install:if_missing" finished
task: [tests] go clean -testcache
task: [tests] go test -cover -race \
            -covermode=atomic\
            -coverprofile=coverage.out \
            -coverpkg $(go list ./... | grep -v -E "(api|cmd)" | tr "\n" ",")  \
            ./... -json |  go tool tparse -trimpath github.com/butuzov/api

task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
task: skipped for file not in sources: coverage.out
task: no valid calls, skipping execution
warning: no packages being tested depend on matches for pattern 
task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
task: skipped for file not in sources: coverage.out
task: no valid calls, skipping execution
task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
task: skipped for file not in sources: coverage.out
task: no valid calls, skipping execution
task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
task: skipped for file not in sources: coverage.out
task: no valid calls, skipping execution
task: received watch event: WRITE         "/Users/butuzov/Desktop/@api/coverage.out"
task: skipped for file not in sources: coverage.out
task: no valid calls, skipping execution

┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃   FAIL  package: github.com/butuzov/api/pkg/biz   ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

--- FAIL: TestUserPostMeta1 (0.00s)

    users_test.go:14: 
                Error Trace:    /Users/butuzov/Desktop/@api/pkg/biz/users_test.go:14
                Error:          Should be empty, but was a
                Test:           TestUserPostMeta1

Version

3.50.0

Operating system

darwin

Experiments Enabled

No response

Example Taskfile

task:
  x-be:dev:base: &x-be-dev-base
    sources:
      - exclude: ./api/v1/service_http.pb.go
      - exclude: ./api/v1/service.pb.go
      - exclude: ./cmd/service/wire_gen.go
      - exclude: ./openapi.yaml
      - exclude: ./taskfile.dist.yaml
      - exclude: ./coverage.out
      - exclude: ./coverage.out_
      - ./**/*.proto
      - ./**/*.yaml
      - ./**/*.go
      - ./scripts/build-pipeline.sh
      - ./scripts/build-servies.sh
    method: timestamp
    silent: true
    ignore_error: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions