Watching golang source w net/http server
my problem is when i run this task, it doesn't tear down the command, so port will be busy on refresh, i am just a beginer in task, plz help me in this
version: '3'
interval: 3s
vars:
serve_cmd: go run cmd/web/main.go serve
tasks:
watchAndRun:
watch: true
sources: ["./*/.go"]
cmds:
- "{{.serve_cmd}}"
kill: SIGINT
desc: Serve the API
dir: $TASKFILE_PWD
2 Replies
Hi @dNaszta,
Task's watcher is not 100% polished, so it may fail in some scenarios.
I suggest you to try dedicated tools like Air (https://github.com/air-verse/air). Both tools can be used together.